• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Logger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: deserializeBody

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
@Override
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
    if (this.destClass == null) {
        throw new IOException("DestClass not set");
    }
    int count = readInt(stream);
    for (int i = 0; i < count; i++) {
        Logger.d("TLVECTOR", "reading: " + i + " from " + count + " (" + this.items.size() + ")" + " --> " + this.destClass);
        if (this.destClass == Integer.class) {
            this.items.add((T) (Integer) readInt(stream));
        } else if (this.destClass == Long.class) {
            this.items.add((T) (Long) readLong(stream));
        } else if (this.destClass == String.class) {
            this.items.add((T) readTLString(stream));
        } else {
            this.items.add((T) context.deserializeMessage(stream));
        }
        Logger.d("TLVECTOR", "Extracted " + this.items.get(i).toString());
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:21,代码来源:TLVector.java


示例2: run

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
@Override
public void run() {
    setPriority(Thread.MIN_PRIORITY);
    while (!MTProto.this.isClosed) {
        if (Logger.LOG_THREADS) {
            Logger.d(MTProto.this.TAG, "Response Iteration");
        }
        synchronized (MTProto.this.inQueue) {
            if (MTProto.this.inQueue.isEmpty()) {
                try {
                    MTProto.this.inQueue.wait();
                } catch (InterruptedException e) {
                    return;
                }
            }
            if (MTProto.this.inQueue.isEmpty()) {
                continue;
            }
        }
        MTMessage message = MTProto.this.inQueue.poll();
        onMTMessage(message);
        BytesCache.getInstance().put(message.getContent());
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:25,代码来源:MTProto.java


示例3: onChannelBroken

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
@Override
public void onChannelBroken(TcpContext context) {
    if (MTProto.this.isClosed) {
        return;
    }
    int contextId = context.getContextId();
    Logger.d(MTProto.this.TAG, "onChannelBroken (#" + contextId + ")");
    synchronized (MTProto.this.contexts) {
        MTProto.this.contexts.remove(context);
        if (!MTProto.this.connectedContexts.contains(contextId)) {
            if (MTProto.this.contextConnectionId.containsKey(contextId)) {
                MTProto.this.exponentalBackoff.onFailureNoWait();
                MTProto.this.connectionRate.onConnectionFailure(MTProto.this.contextConnectionId.get(contextId));
            }
        }
        MTProto.this.contexts.notifyAll();
    }
    MTProto.this.scheduller.onConnectionDies(context.getContextId());
    requestSchedule();
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:21,代码来源:MTProto.java


示例4: suspendConnectionInternal

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
private void suspendConnectionInternal() {
    synchronized (timerSync) {
        if (reconnectTimer != null) {
            reconnectTimer.cancel();
            reconnectTimer = null;
        }
    }
    if ((connectionState == ConnectionState.TcpConnectionStageIdle) || (connectionState == ConnectionState.TcpConnectionStageSuspended)) {
        return;
    }
    Logger.d(TcpContext.this.TAG, "suspend connnection " + TcpContext.this);
    connectionState = ConnectionState.TcpConnectionStageSuspended;
    if (client != null) {
        client.removeListener(TcpContext.this);
        client.dropConnection();
        client = null;
    }
    callback.onChannelBroken(TcpContext.this);
    isFirstPackage = true;
    if (restOfTheData != null) {
        BuffersStorage.getInstance().reuseFreeBuffer(restOfTheData);
        restOfTheData = null;
    }
    lastPacketLength = 0;
    channelToken = 0;
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:27,代码来源:TcpContext.java


示例5: readString

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
public String readString(boolean exception) {
    try {
        int sl = 1;
        int l = getIntFromByte(this.buffer.get());
        if(l >= 254) {
            l = getIntFromByte(this.buffer.get()) | (getIntFromByte(this.buffer.get()) << 8) | (getIntFromByte(this.buffer.get()) << 16);
            sl = 4;
        }
        final byte[] b = new byte[l];
        this.buffer.get(b);
        int i = sl;
        while(((l + i) % 4) != 0) {
            this.buffer.get();
            i++;
        }
        return new String(b, "UTF-8");
    } catch (Exception e) {
        if (exception) {
            throw new RuntimeException("read string error", e);
        } else {
            Logger.w("tmessages", "read string error");
        }
    }
    return null;
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:26,代码来源:ByteBufferDesc.java


示例6: readByteArray

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
public byte[] readByteArray(boolean exception) {
    try {
        int sl = 1;
        int l = getIntFromByte(this.buffer.get());
        if (l >= 254) {
            l = getIntFromByte(this.buffer.get()) | (getIntFromByte(this.buffer.get()) << 8) | (getIntFromByte(this.buffer.get()) << 16);
            sl = 4;
        }
        final byte[] b = new byte[l];
        this.buffer.get(b);
        int i = sl;
        while(((l + i) % 4) != 0) {
            this.buffer.get();
            i++;
        }
        return b;
    } catch (Exception e) {
        if (exception) {
            throw new RuntimeException("read byte array error", e);
        } else {
            Logger.w("tmessages", "read byte array error");
        }
    }
    return null;
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:26,代码来源:ByteBufferDesc.java


示例7: run

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
@Override
public void run() {
    setPriority(Thread.MIN_PRIORITY);
    while (!isClosed) {
        if (Logger.LOG_THREADS) {
            Logger.d(TAG, "Response Iteration");
        }
        synchronized (inQueue) {
            if (inQueue.isEmpty()) {
                try {
                    inQueue.wait();
                } catch (InterruptedException e) {
                    return;
                }
            }
            if (inQueue.isEmpty()) {
                continue;
            }
        }
        MTMessage message = inQueue.poll();
        onMTMessage(message);
        BytesCache.getInstance().put(message.getContent());
    }
}
 
开发者ID:ardock,项目名称:telegram-mt,代码行数:25,代码来源:MTProto.java


示例8: onChannelBroken

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
@Override
public void onChannelBroken(TcpContext context) {
    if (isClosed) {
        return;
    }
    int contextId = context.getContextId();
    Logger.d(TAG, "onChannelBroken (#" + contextId + ")");
    synchronized (contexts) {
        contexts.remove(context);
        if (!connectedContexts.contains(contextId)) {
            if (contextConnectionId.containsKey(contextId)) {
                exponentalBackoff.onFailureNoWait();
                connectionRate.onConnectionFailure(contextConnectionId.get(contextId));
            }
        }
        contexts.notifyAll();
    }
    scheduller.onConnectionDies(context.getContextId());
    requestSchedule();
}
 
开发者ID:ardock,项目名称:telegram-mt,代码行数:21,代码来源:MTProto.java


示例9: 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


示例10: 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


示例11: 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


示例12: skipBytes

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
/**
 * Reading bytes from stream
 *
 * @param count  bytes count
 * @param stream source stream
 * @return readed bytes
 * @throws IOException reading exception
 */
//public static void skipBytes(int count, InputStream stream) throws IOException {
//    stream.skip(count);
//}

public static void skipBytes(int count, InputStream stream) throws IOException {
    byte[] bytes = new byte[count];
    stream.read(bytes);
    Logger.d("SKIPED", "Skypped " + count + " bytes: " + bytes);
    //stream.skip(count);
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:19,代码来源:StreamingUtils.java


示例13: resendAsNewMessageDelayed

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
public void resendAsNewMessageDelayed(long msgId, long delay) {
    for (SchedullerPackage schedullerPackage : this.messages.values().toArray(new SchedullerPackage[0])) {
        if (schedullerPackage.relatedMessageIds.contains(msgId)) {
            schedullerPackage.idGenerationTime = 0;
            schedullerPackage.dependMessageId = 0;
            schedullerPackage.messageId = 0;
            schedullerPackage.seqNo = 0;
            schedullerPackage.state = STATE_QUEUED;
            schedullerPackage.scheduleTime = getCurrentTime() + delay;
            Logger.d(this.TAG, "Resending as new #" + schedullerPackage.id);
        }
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:14,代码来源:Scheduller.java


示例14: onConnectionDies

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
public synchronized void onConnectionDies(int connectionId) {
    Logger.d(this.TAG, "Connection dies " + connectionId);
    for (SchedullerPackage schedullerPackage : this.messages.values().toArray(new SchedullerPackage[0])) {
        if (schedullerPackage.writtenToChannel != connectionId) {
            continue;
        }

        if (schedullerPackage.queuedToChannel != -1) {
            Logger.d(this.TAG, "Removing: #" + schedullerPackage.id + " " + schedullerPackage.supportTag);
            forgetMessage(schedullerPackage.id);
        } else {
            if (schedullerPackage.isRpc) {
                if (schedullerPackage.state == STATE_CONFIRMED || schedullerPackage.state == STATE_QUEUED) {
                    Logger.d(this.TAG, "Re-schedule: #" + schedullerPackage.id + " " + schedullerPackage.supportTag);
                    schedullerPackage.state = STATE_QUEUED;
                    schedullerPackage.lastAttemptTime = 0;
                }
            } else {
                if (schedullerPackage.state == STATE_SENT) {
                    Logger.d(this.TAG, "Re-schedule: #" + schedullerPackage.id + " " + schedullerPackage.supportTag);
                    schedullerPackage.state = STATE_QUEUED;
                    schedullerPackage.lastAttemptTime = 0;
                }
            }

        }
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:29,代码来源:Scheduller.java


示例15: sendMessage

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
public int sendMessage(TLObject request, long timeout, boolean isRpc, boolean highPriority) {
    final int id = this.scheduller.postMessage(request, isRpc, timeout, highPriority);
    Logger.d(this.TAG, "sendMessage #" + id + " " + request.toString());
    synchronized (this.scheduller) {
        this.scheduller.notifyAll();
    }

    return id;
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:10,代码来源:MTProto.java


示例16: 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


示例17: tryConnection

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
public synchronized ConnectionType tryConnection() {
    float value = this.rnd.nextFloat();
    Transport[] currentTransports = this.transports.values().toArray(new Transport[0]);
    Arrays.sort(currentTransports, new Comparator<Transport>() {
        @Override
        public int compare(Transport transport, Transport transport2) {
            return -Float.compare(transport.getRate(), transport2.getRate());
        }
    });
    ConnectionType type = currentTransports[0].getConnectionType();
    Logger.d(TAG, "tryConnection #" + type.getId());
    return type;
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:14,代码来源:TransportRate.java


示例18: 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


示例19: 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


示例20: reuseFreeBuffer

import org.telegram.mtproto.log.Logger; //导入依赖的package包/类
public void reuseFreeBuffer(ByteBufferDesc buffer) {
    if (buffer == null) {
        return;
    }
    int maxCount = 10;
    ArrayList<ByteBufferDesc> arrayToReuse = null;
    if (buffer.buffer.capacity() == 128) {
        arrayToReuse = freeBuffers128;
    } else if (buffer.buffer.capacity() == 1024 + 200) {
        arrayToReuse = freeBuffers1024;
    } if (buffer.buffer.capacity() == 4096 + 200) {
        arrayToReuse = freeBuffers4096;
    } else if (buffer.buffer.capacity() == 16384 + 200) {
        arrayToReuse = freeBuffers16384;
    } else if (buffer.buffer.capacity() == 40000) {
        arrayToReuse = freeBuffers32768;
    } else if (buffer.buffer.capacity() == 280000) {
        arrayToReuse = freeBuffersBig;
        maxCount = 10;
    }
    if (arrayToReuse != null) {
        if (isThreadSafe) {
            synchronized (sync) {
                if (arrayToReuse.size() < maxCount) {
                    arrayToReuse.add(buffer);
                } else {
                    Logger.w("tmessages", "too more");
                }
            }
        } else {
            if (arrayToReuse.size() < maxCount) {
                arrayToReuse.add(buffer);
            }
        }
    }
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:37,代码来源:BuffersStorage.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientCacheEntryCreated类代码示例发布时间:2022-05-22
下一篇:
Java MessageObserver类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap