当前位置: 首页>>代码示例>>Java>>正文


Java Logger.e方法代码示例

本文整理汇总了Java中org.telegram.mtproto.log.Logger.e方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.e方法的具体用法?Java Logger.e怎么用?Java Logger.e使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.mtproto.log.Logger的用法示例。


在下文中一共展示了Logger.e方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readBytes

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
private byte[] readBytes(int count, int timeout, InputStream stream) throws IOException {
    byte[] res = BytesCache.getInstance().allocate(count);
    int offset = 0;
    long start = System.nanoTime();
    while (offset < count) {
        int readed = stream.read(res, offset, count - offset);
        Thread.yield();
        if (readed > 0) {
            offset += readed;
            onRead();
        } else if (readed < 0) {
            throw new IOException();
        } else {
            if (System.nanoTime() - start > timeout * 1000000L) {
                throw new IOException();
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                Logger.e(TAG, e);
                throw new IOException();
            }
        }
    }
    return res;
}
 
开发者ID:ardock,项目名称:telegram-mt,代码行数:27,代码来源:TcpContext.java

示例2: registerClass

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public <T extends TLObject> void registerClass(Class<T> tClass) {
    try {
        int classId = tClass.getField("CLASS_ID").getInt(null);
        this.registeredClasses.put(classId, tClass);
    } catch (IllegalAccessException | NoSuchFieldException e) {
        e.printStackTrace();
        Logger.e(TAG, e);
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:10,代码来源:TLContext.java

示例3: registerCompatClass

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public <T extends TLObject> void registerCompatClass(Class<T> tClass) {
    try {
        int classId = tClass.getField("CLASS_ID").getInt(null);
        this.registeredCompatClasses.put(classId, tClass);
    } catch (IllegalAccessException | NoSuchFieldException e) {
        e.printStackTrace();
        Logger.e(TAG, e);
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:10,代码来源:TLContext.java

示例4: onError

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
@Override
public void onError(int errorCode, TcpContext context) {
    if (MTProto.this.isClosed) {
        return;
    }

    Logger.e(MTProto.this.TAG, "OnError (#" + context.getContextId() + "): " + errorCode);
    context.suspendConnection(true);
    context.connect();
    // Fully maintained at transport level: TcpContext dies
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:12,代码来源:MTProto.java

示例5: destroy

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void destroy() {
    try {
        this.socket.close();
    } catch (IOException e) {
        Logger.e(TAG, e);
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:8,代码来源:PlainTcpConnection.java

示例6: receivedData

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
@Override
public void receivedData(PyroClient client, ByteBuffer data) {
    try {
        failedConnectionCount = 0;
        readData(data);
    } catch (Exception e) {
        Logger.e(TcpContext.this.TAG, e);
        reconnect();
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:11,代码来源:TcpContext.java

示例7: writeByteBuffer

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void writeByteBuffer(ByteBufferDesc b) {
    try {
        final int l = b.limit();
        if (l <= 253) {
            if (this.justCalc) {
                this.len += 1;
            } else {
                this.buffer.put((byte) l);
            }
        } else {
            if (this.justCalc) {
                this.len += 4;
            } else {
                this.buffer.put((byte) 254);
                this.buffer.put((byte) l);
                this.buffer.put((byte) (l >> 8));
                this.buffer.put((byte) (l >> 16));
            }
        }
        if (this.justCalc) {
            this.len += l;
        } else {
            b.rewind();
            this.buffer.put(b.buffer);
        }
        int i = (l <= 253) ? 1 : 4;
        while(((l + i) % 4) != 0) {
            if (this.justCalc) {
                this.len += 1;
            } else {
                this.buffer.put((byte) 0);
            }
            i++;
        }
    } catch (Exception e) {
        Logger.e("tmessages", e);
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:39,代码来源:ByteBufferDesc.java

示例8: destroy

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
public void destroy() {
    try {
        socket.close();
    } catch (IOException e) {
        Logger.e(TAG, e);
    }
}
 
开发者ID:ardock,项目名称:telegram-mt,代码行数:8,代码来源:PlainTcpConnection.java

示例9: actualPackages

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
private synchronized ArrayList<SchedullerPackage> actualPackages(int contextId) {
    ArrayList<SchedullerPackage> foundedPackages = new ArrayList<SchedullerPackage>();
    long time = getCurrentTime();
    for (SchedullerPackage schedullerPackage : this.messages.values().toArray(new SchedullerPackage[0])) {
        if (schedullerPackage.queuedToChannel != -1 && contextId != schedullerPackage.queuedToChannel) {
            continue;
        }
        boolean isPendingPackage = false;

        if (schedullerPackage.ttlTime <= getCurrentTime()) {
            forgetMessage(schedullerPackage.id);
            continue;
        }

        if (schedullerPackage.state == STATE_QUEUED) {
            if (schedullerPackage.scheduleTime <= time) {
                isPendingPackage = true;
            }
        } else if (schedullerPackage.state == STATE_SENT) {
            if (getCurrentTime() <= schedullerPackage.expiresTime) {
                if (getCurrentTime() - schedullerPackage.lastAttemptTime >= RETRY_TIMEOUT) {
                    isPendingPackage = true;
                }
            }
        }

        if (isPendingPackage) {
            if (schedullerPackage.serialized == null) {
                try {
                    if (schedullerPackage.isRpc) {
                        schedullerPackage.serialized = this.wrapper.wrapObject((TLMethod) schedullerPackage.object).serialize();
                    } else {
                        schedullerPackage.serialized = schedullerPackage.object.serialize();
                    }
                } catch (IOException e) {
                    Logger.e(this.TAG, e);
                    forgetMessage(schedullerPackage.id);
                    continue;
                }
            }

            foundedPackages.add(schedullerPackage);
        }
    }
    return foundedPackages;
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:47,代码来源:Scheduller.java

示例10: handleDisconnect

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
private synchronized void handleDisconnect(PyroClient client, boolean timeout) {
    synchronized (timerSync) {
        if (reconnectTimer != null) {
            reconnectTimer.cancel();
            reconnectTimer = null;
        }
    }

    isFirstPackage = true;
    if (restOfTheData != null) {
        BuffersStorage.getInstance().reuseFreeBuffer(restOfTheData);
        restOfTheData = null;
    }
    channelToken = 0;
    lastPacketLength = 0;
    if ((connectionState != ConnectionState.TcpConnectionStageSuspended) && (connectionState != ConnectionState.TcpConnectionStageIdle)) {
        connectionState = ConnectionState.TcpConnectionStageIdle;
    }

    callback.onChannelBroken(TcpContext.this);

    if (connectionState == ConnectionState.TcpConnectionStageIdle) {
        failedConnectionCount++;
        if (failedConnectionCount == 1) {
            if (hasSomeDataSinceLastConnect) {
                willRetryConnectCount = 5;
            } else {
                willRetryConnectCount = 1;
            }
        }
        Logger.d(TcpContext.this.TAG, "Reconnect " + ip + ":" + port + " " + TcpContext.this);
        try {
            synchronized (timerSync) {
                reconnectTimer = new Timer();
                reconnectTimer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        selector.scheduleTask(() -> {
                            try {
                                synchronized (timerSync) {
                                    if (reconnectTimer != null) {
                                        reconnectTimer.cancel();
                                        reconnectTimer = null;
                                    }
                                }
                            } catch (Exception e2) {
                                Logger.e(TcpContext.this.TAG, e2);
                            }
                            connect();
                        });
                    }
                }, (failedConnectionCount > 3) ? 500 : 300, (failedConnectionCount > 3) ? 500 : 300);
            }
        } catch (Exception e3) {
            Logger.e(TcpContext.this.TAG, e3);
        }
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:59,代码来源:TcpContext.java

示例11: actualPackages

import org.telegram.mtproto.log.Logger; //导入方法依赖的package包/类
private synchronized ArrayList<SchedullerPackage> actualPackages(int contextId) {
    ArrayList<SchedullerPackage> foundedPackages = new ArrayList<SchedullerPackage>();
    long time = getCurrentTime();
    for (SchedullerPackage schedullerPackage : messages.values().toArray(new SchedullerPackage[0])) {
        if (schedullerPackage.queuedToChannel != -1 && contextId != schedullerPackage.queuedToChannel) {
            continue;
        }
        boolean isPendingPackage = false;

        if (schedullerPackage.ttlTime <= getCurrentTime()) {
            forgetMessage(schedullerPackage.id);
            continue;
        }

        if (schedullerPackage.state == STATE_QUEUED) {
            if (schedullerPackage.scheduleTime <= time) {
                isPendingPackage = true;
            }
        } else if (schedullerPackage.state == STATE_SENT) {
            if (getCurrentTime() <= schedullerPackage.expiresTime) {
                if (getCurrentTime() - schedullerPackage.lastAttemptTime >= RETRY_TIMEOUT) {
                    isPendingPackage = true;
                }
            }
        }

        if (isPendingPackage) {
            if (schedullerPackage.serialized == null) {
                try {
                    if (schedullerPackage.isRpc) {
                        schedullerPackage.serialized = wrapper.wrapObject((TLMethod) schedullerPackage.object).serialize();
                    } else {
                        schedullerPackage.serialized = schedullerPackage.object.serialize();
                    }
                } catch (IOException e) {
                    Logger.e(TAG, e);
                    forgetMessage(schedullerPackage.id);
                    continue;
                }
            }

            foundedPackages.add(schedullerPackage);
        }
    }
    return foundedPackages;
}
 
开发者ID:ardock,项目名称:telegram-mt,代码行数:47,代码来源:Scheduller.java


注:本文中的org.telegram.mtproto.log.Logger.e方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。