當前位置: 首頁>>代碼示例>>Java>>正文


Java LogLevel類代碼示例

本文整理匯總了Java中lbms.plugins.mldht.kad.DHT.LogLevel的典型用法代碼示例。如果您正苦於以下問題:Java LogLevel類的具體用法?Java LogLevel怎麽用?Java LogLevel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LogLevel類屬於lbms.plugins.mldht.kad.DHT包,在下文中一共展示了LogLevel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stop

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
public void stop() {
	if(state == State.STOPPED)
		return;
	state = State.STOPPED;
	
	try
	{
		sel.close();
	} catch (IOException e)
	{
		DHT.log(e, LogLevel.Error);
	}
	dh_table.getNode().removeId(derivedId);
	manager.serverRemoved(this);
	pipeline.clear();
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:17,代碼來源:RPCServer.java

示例2: PullMetaDataConnection

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
public PullMetaDataConnection(SocketChannel chan)
{
	channel = chan;
	incoming = true;
	connectionOpenTime = System.currentTimeMillis();

	try
	{
		channel.configureBlocking(false);
	} catch (IOException e)
	{
		DHT.log(e, LogLevel.Error);
	}
	
	remoteAddress = (InetSocketAddress) chan.socket().getRemoteSocketAddress();
	setState(STATE_INITIAL, STATE_BASIC_HANDSHAKING);
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:18,代碼來源:PullMetaDataConnection.java

示例3: terminate

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
public void terminate(String reasonStr, CloseReason reason)  throws IOException  {
	synchronized (this) {
		CONNECTION_STATE oldState = state.get();
		if(!setState(EnumSet.complementOf(EnumSet.of(STATE_CLOSED)), STATE_CLOSED))
			return;
		//if(!isState(STATE_CONNECTING))
			//System.out.println("closing connection for "+(infoHash != null ? new Key(infoHash).toString(false) : null)+" to "+destination+"/"+remoteClient+" state:"+state+" reason:"+reason);
		if(pool != null)
			pool.deRegister(this);

		closeReason = reason;
		if(metaHandler != null)
			metaHandler.onTerminate();
		
		channel.close();
		
		if(DHT.isLogLevelEnabled(LogLevel.Debug)) {
			String closemsg = String.format("closing pull connection inc: %b reason: %s flag: %s state: %s pid: %s fast: %b age: %d", incoming, reasonStr, reason, oldState, stripToAscii(remotePeerId), remoteSupportsFastExtension, System.currentTimeMillis() - connectionOpenTime);
			DHT.log(closemsg , LogLevel.Debug);
		}
	}
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:23,代碼來源:PullMetaDataConnection.java

示例4: stop

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
public void stop() {
	if(state == State.STOPPED)
		return;
	state = State.STOPPED;
	
	try
	{
		sel.close();
	} catch (IOException e)
	{
		DHT.log(e, LogLevel.Error);
	}
	dh_table.getNode().removeId(derivedId);
	manager.serverRemoved(this);
	Stream.of(calls.values().stream(), call_queue.stream(), pipeline.stream().map(es -> es.associatedCall).filter(Objects::nonNull)).flatMap(s -> s).forEach(r -> {
		r.cancel();
	});
	pipeline.clear();
	DHT.logInfo("Stopped RPC Server " + addr + " " + derivedId.toString(false));
}
 
開發者ID:the8472,項目名稱:mldht,代碼行數:21,代碼來源:RPCServer.java

示例5: selectLoop

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
void selectLoop() {
	
	iterations = 0;
	lastNonZeroIteration = 0;
	
	while(true)
	{
		try
		{
			wakeupCalled = false;
			selector.select(100);
			wakeupCalled = false;
			
			connectionChecks();
			processSelected();
			handleRegistrations();
			updateInterestOps();

				
		} catch (Exception e)
		{
			DHT.log(e, LogLevel.Error);
		}
		
		iterations++;
		
		if(suspendOnIdle())
			break;
	}
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:31,代碼來源:NIOConnectionManager.java

示例6: update

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
@Override
void update () {
	for(;;) {
		// while(!todo.isEmpty() && canDoRequest() && !isClosestSetStable() && !nextTodoUseless())
		RequestPermit p = checkFreeSlot();
		if(p == RequestPermit.NONE_ALLOWED)
			return;
		
		KBucketEntry e = todo.next().orElse(null);
		
		if(e == null)
			return;
		
		if(!new RequestCandidateEvaluator(this, closest, todo, e, inFlight).goodForRequest(p))
			return;
			
		// send a findNode to the node
		FindNodeRequest fnr = new FindNodeRequest(targetKey);
		fnr.setWant4(rpc.getDHT().getType() == DHTtype.IPV4_DHT || rpc.getDHT().getSiblings().stream().anyMatch(sib -> sib.isRunning() && sib.getType() == DHTtype.IPV4_DHT && sib.getNode().getNumEntriesInRoutingTable() < DHTConstants.BOOTSTRAP_IF_LESS_THAN_X_PEERS));
		fnr.setWant6(rpc.getDHT().getType() == DHTtype.IPV6_DHT || rpc.getDHT().getSiblings().stream().anyMatch(sib -> sib.isRunning() && sib.getType() == DHTtype.IPV6_DHT && sib.getNode().getNumEntriesInRoutingTable() < DHTConstants.BOOTSTRAP_IF_LESS_THAN_X_PEERS));
		fnr.setDestination(e.getAddress());
		
		if(!rpcCall(fnr,e.getID(), (call) -> {
			long rtt = e.getRTT();
			rtt = rtt + rtt / 2; // *1.5 since this is the average and not the 90th percentile like the timeout filter
			if(rtt < DHTConstants.RPC_CALL_TIMEOUT_MAX && rtt < rpc.getTimeoutFilter().getStallTimeout())
				call.setExpectedRTT(rtt); // only set a node-specific timeout if it's better than what the server would apply anyway
			call.builtFromEntry(e);
			todo.addCall(call, e);
			
			if(DHT.isLogLevelEnabled(LogLevel.Verbose)) {
				List<InetSocketAddress> sources = todo.getSources(e).stream().map(KBucketEntry::getAddress).collect(Collectors.toList());
				DHT.log("Task "+getTaskID()+" sending call to "+ e + " sources:" + sources, LogLevel.Verbose);
			}
		})) {
			break;
		}
			
	}
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:41,代碼來源:NodeLookup.java

示例7: start

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
/**
 *  Start the task, to be used when a task is queued.
 */
public void start () {
	if (setState(EnumSet.of(TaskState.INITIAL, TaskState.QUEUED), TaskState.RUNNING)) {
		DHT.logDebug("Starting Task: " + toString());
		startTime = System.currentTimeMillis();
		try
		{
			serializedUpdate.run();
		} catch (Exception e)
		{
			DHT.log(e, LogLevel.Error);
		}
	}
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:17,代碼來源:Task.java

示例8: getStringFromBytes

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
private static String getStringFromBytes (byte[] bytes, boolean preserveBytes) {
	if (bytes == null) {
		return null;
	}
	try {
		return new String(bytes, preserveBytes ? StandardCharsets.ISO_8859_1 : StandardCharsets.UTF_8);
	} catch (Exception e) {
		DHT.log(e, LogLevel.Verbose);
		return null;
	}
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:12,代碼來源:MessageDecoder.java

示例9: ConnectionAcceptor

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
public ConnectionAcceptor(Predicate<SocketChannel> acc) {
	acceptor = acc;
	
	try
	{
		channel = ServerSocketChannel.open();
		channel.configureBlocking(false);
	} catch (IOException e)
	{
		DHT.log(e, LogLevel.Error);
	}
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:13,代碼來源:ConnectionAcceptor.java

示例10: Launcher

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
public Launcher() {
	configReader = new ConfigReader(Paths.get(".", "config.xml"), configDefaults, configSchema);
	configReader.read();
	
	scheduler = new NonblockingScheduledExecutor("mlDHT", Math.max(Runtime.getRuntime().availableProcessors(), 4), (t, ex) ->  {
		logger.log(ex, LogLevel.Fatal);
	});
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:9,代碼來源:Launcher.java

示例11: update

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
@Override
void update () {
	// check if the cache has any closer nodes after the initial query
	if(useCache) {
		Collection<KBucketEntry> cacheResults = cache.get(targetKey, requestConcurrency());
		todo.addCandidates(null, cacheResults);
	}

	for(;;) {
		synchronized (this) {
			RequestPermit p = checkFreeSlot();
			
			if(p == RequestPermit.NONE_ALLOWED)
				break;
			
			KBucketEntry e = todo.next2(kbe -> {
				RequestCandidateEvaluator eval = new RequestCandidateEvaluator(this, closest, todo, kbe, inFlight);
				return eval.goodForRequest(p);
			}).orElse(null);
			
			if(e == null)
				break;
			
			GetPeersRequest gpr = new GetPeersRequest(targetKey);
			// we only request cross-seeding on find-node
			gpr.setWant4(rpc.getDHT().getType() == DHTtype.IPV4_DHT);
			gpr.setWant6(rpc.getDHT().getType() == DHTtype.IPV6_DHT);
			gpr.setDestination(e.getAddress());
			gpr.setScrape(scrapeHandler != null);
			gpr.setNoSeeds(noSeeds);
			
			if(!rpcCall(gpr, e.getID(), call -> {
				if(useCache)
					call.addListener(cache.getRPCListener());
				call.builtFromEntry(e);

				long rtt = e.getRTT();
				long defaultTimeout = rpc.getTimeoutFilter().getStallTimeout();
				
				if(rtt < DHTConstants.RPC_CALL_TIMEOUT_MAX) {
					// the measured RTT is a mean and not the 90th percentile unlike the RPCServer's timeout filter
					// -> add some safety margin to account for variance
					rtt = (long) (rtt * (rtt < defaultTimeout ? 2 : 1.5));
					
					call.setExpectedRTT(min(rtt, DHTConstants.RPC_CALL_TIMEOUT_MAX));
				}
				
				if(DHT.isLogLevelEnabled(LogLevel.Verbose)) {
					List<InetSocketAddress> sources = todo.getSources(e).stream().map(KBucketEntry::getAddress).collect(Collectors.toList());
					DHT.log("Task "+getTaskID()+" sending call to "+ e + " sources:" + sources, LogLevel.Verbose);
				}
					
				
				todo.addCall(call, e);
			})) {
				break;
			}
		}
	}

}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:62,代碼來源:PeerLookupTask.java

示例12: setLogLevel

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
private void setLogLevel() {
	String rawLevel = configReader.get(XMLUtils.buildXPath("//core/logLevel")).orElse("Info");
	LogLevel level = LogLevel.valueOf(rawLevel);
	DHT.setLogLevel(level);
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:6,代碼來源:Launcher.java

示例13: TorrentFetcher

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
public TorrentFetcher(Collection<DHT> dhts) {
	this.dhts = dhts;
	timer = new LoggingScheduledThreadPoolExecutor(1, LoggingScheduledThreadPoolExecutor.namedDaemonFactory("TorrentFetcher Timer"), t -> DHT.log(t, LogLevel.Fatal));
	timer.setKeepAliveTime(4, TimeUnit.SECONDS);
	timer.allowCoreThreadTimeOut(true);
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:7,代碼來源:TorrentFetcher.java

示例14: incomingConnection

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
boolean incomingConnection(SocketChannel chan) {
	PullMetaDataConnection con = new PullMetaDataConnection(chan);
	
	if(incomingConnections.get() > maxIncoming)
		return false;
	
	incomingConnections.incrementAndGet();
	
	con.setListener(new MetaConnectionHandler() {
		
		@Override
		public void onTerminate() {
			incomingConnections.decrementAndGet();
			
		}
		
		@Override
		public void onStateChange(CONNECTION_STATE oldState, CONNECTION_STATE newState) {
			if(newState == CONNECTION_STATE.STATE_IH_RECEIVED) {
				Key ih = con.getInfohash();
				try {
					Optional<FetchTask> ft;
					
					synchronized (TorrentFetcher.this) {
						ft = tasks.stream()
								.filter((t -> t.hash.equals(ih)))
								.findAny();
					}
					
					if (!ft.isPresent()) {
						con.terminate("currently not servicing infohash " + ih.toString(false), CloseReason.OTHER);
						return;
					}

					ft.get().registerIncomingConnection(con);
				} catch (IOException e) {
					DHT.log(e, LogLevel.Error);
				}
			}
			
		}
		
		@Override
		public void onConnect() {
			// TODO Auto-generated method stub
			
		}
	});
	conMan.register(con);
	
	return true;
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:53,代碼來源:TorrentFetcher.java

示例15: log

import lbms.plugins.mldht.kad.DHT.LogLevel; //導入依賴的package包/類
void log(Throwable t) {
	DHT.log(t, LogLevel.Error);
}
 
開發者ID:atomashpolskiy,項目名稱:bt,代碼行數:4,代碼來源:TorrentDumper.java


注:本文中的lbms.plugins.mldht.kad.DHT.LogLevel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。