本文整理匯總了Java中net.tomp2p.p2p.RequestP2PConfiguration類的典型用法代碼示例。如果您正苦於以下問題:Java RequestP2PConfiguration類的具體用法?Java RequestP2PConfiguration怎麽用?Java RequestP2PConfiguration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RequestP2PConfiguration類屬於net.tomp2p.p2p包,在下文中一共展示了RequestP2PConfiguration類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTaskSubmit1
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
@Test
public void testTaskSubmit1() throws Exception {
Peer master = null;
try {
// setup
Peer[] peers = Utils2.createNodes(200, rnd, 4001);
master = peers[0];
Utils2.perfectRouting(peers);
// do testing
Number160 locationKey = new Number160(rnd);
FutureTask ft = peers[12].submit(locationKey, new Worker2())
.setRequestP2PConfiguration(new RequestP2PConfiguration(1, 0, 0)).start();
ft.awaitUninterruptibly();
Assert.assertEquals(true, ft.isSuccess());
Assert.assertEquals(1, ft.getRawDataMap().size());
} finally {
System.out.println("done");
master.halt();
}
}
示例2: testTaskSubmit2
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
@Test
public void testTaskSubmit2() throws Exception {
Peer master = null;
try {
// setup
Peer[] peers = Utils2.createNodes(200, rnd, 4001);
master = peers[0];
Utils2.perfectRouting(peers);
// do testing
Number160 locationKey = new Number160(rnd);
FutureTask ft = peers[12].submit(locationKey, new Worker2())
.setRequestP2PConfiguration(new RequestP2PConfiguration(2, 0, 0)).start();
ft.awaitUninterruptibly();
Assert.assertEquals(true, ft.isSuccess());
Assert.assertEquals(2, ft.getRawDataMap().size());
} finally {
System.out.println("done");
master.halt();
}
}
示例3: create
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
/**
* This will calculate the number of required connection for routing and request messages.
*
* @param routingConfiguration
* Contains the number of routing requests in parallel
* @param requestP2PConfiguration
* Contains the number of requests for P2P operations in parallel
* @param builder
* The builder that tells us if we should use TCP or UPD
* @return The future channel creator
*/
public FutureChannelCreator create(final RoutingConfiguration routingConfiguration,
final RequestP2PConfiguration requestP2PConfiguration, final DHTBuilder<?> builder) {
if (routingConfiguration == null && requestP2PConfiguration == null) {
throw new IllegalArgumentException(
"Both routingConfiguration and requestP2PConfiguration cannot be null");
}
int nrConnectionsTCP = 0;
int nrConnectionsUDP = 0;
if (requestP2PConfiguration != null) {
if (builder.isForceUDP()) {
nrConnectionsUDP = requestP2PConfiguration.getParallel();
} else {
nrConnectionsTCP = requestP2PConfiguration.getParallel();
}
}
if (routingConfiguration != null) {
if (!builder.isForceTCP()) {
nrConnectionsUDP = Math.max(nrConnectionsUDP, routingConfiguration.getParallel());
} else {
nrConnectionsTCP = Math.max(nrConnectionsTCP, routingConfiguration.getParallel());
}
}
return create(nrConnectionsUDP, nrConnectionsTCP);
}
示例4: exampleSendOne
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
private static void exampleSendOne(Peer peer)
{
RequestP2PConfiguration requestP2PConfiguration = new RequestP2PConfiguration( 1, 10, 0 );
FutureDHT futureDHT = peer.send( Number160.createHash( "key" ) ).setObject( "hello" ).setRequestP2PConfiguration( requestP2PConfiguration ).start();
futureDHT.awaitUninterruptibly();
for(Object object:futureDHT.getRawDirectData2().values())
{
System.err.println("got:"+ object);
}
}
示例5: createBuilder
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
public RoutingBuilder createBuilder(RequestP2PConfiguration requestP2PConfiguration,
RoutingConfiguration routingConfiguration) {
RoutingBuilder routingBuilder = new RoutingBuilder();
routingBuilder.setParallel(routingConfiguration.getParallel());
routingBuilder.setMaxNoNewInfo(routingConfiguration.getMaxNoNewInfo(requestP2PConfiguration
.getMinimumResults()));
routingBuilder.setMaxDirectHits(routingConfiguration.getMaxDirectHits());
routingBuilder.setMaxFailures(routingConfiguration.getMaxFailures());
routingBuilder.setMaxSuccess(routingConfiguration.getMaxSuccess());
return routingBuilder;
}
示例6: createBuilder
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
private RoutingBuilder createBuilder(RequestP2PConfiguration requestP2PConfiguration,
RoutingConfiguration routingConfiguration) {
RoutingBuilder routingBuilder = new RoutingBuilder();
routingBuilder.setParallel(routingConfiguration.getParallel());
routingBuilder.setMaxNoNewInfo(routingConfiguration.getMaxNoNewInfo(requestP2PConfiguration
.getMinimumResults()));
routingBuilder.setMaxDirectHits(Integer.MAX_VALUE);
routingBuilder.setMaxFailures(routingConfiguration.getMaxFailures());
routingBuilder.setMaxSuccess(routingConfiguration.getMaxSuccess());
routingBuilder.setForceRoutingOnlyToSelf(forceRoutingOnlyToSelf);
return routingBuilder;
}
示例7: createSendingConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
private RequestP2PConfiguration createSendingConfiguration() {
return new RequestP2PConfiguration(1, 10, 0);
}
示例8: getRequestP2PConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
public RequestP2PConfiguration getRequestP2PConfiguration() {
return requestP2PConfiguration;
}
示例9: setRequestP2PConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
public SubmitBuilder setRequestP2PConfiguration(RequestP2PConfiguration requestP2PConfiguration) {
this.requestP2PConfiguration = requestP2PConfiguration;
return this;
}
示例10: getRequestP2PConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
/**
* @return The P2P request configuration options
*/
public RequestP2PConfiguration getRequestP2PConfiguration() {
return requestP2PConfiguration;
}
示例11: setRequestP2PConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
public BootstrapBuilder setRequestP2PConfiguration(RequestP2PConfiguration requestP2PConfiguration) {
this.requestP2PConfiguration = requestP2PConfiguration;
return this;
}
示例12: createBuilder
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
public RoutingBuilder createBuilder(RequestP2PConfiguration requestP2PConfiguration,
RoutingConfiguration routingConfiguration);
示例13: setRequestP2PConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
/**
* @param requestP2PConfiguration
* The P2P request configuration options
* @return This object
*/
public K setRequestP2PConfiguration(final RequestP2PConfiguration requestP2PConfiguration) {
this.requestP2PConfiguration = requestP2PConfiguration;
return self;
}
示例14: getRequestP2PConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
public RequestP2PConfiguration getRequestP2PConfiguration();
示例15: setRequestP2PConfiguration
import net.tomp2p.p2p.RequestP2PConfiguration; //導入依賴的package包/類
public K setRequestP2PConfiguration(RequestP2PConfiguration requestP2PConfiguration);