本文整理汇总了Java中se.sics.kompics.Positive类的典型用法代码示例。如果您正苦于以下问题:Java Positive类的具体用法?Java Positive怎么用?Java Positive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Positive类属于se.sics.kompics包,在下文中一共展示了Positive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ThreePhaseGossip
import se.sics.kompics.Positive; //导入依赖的package包/类
public ThreePhaseGossip(RetryComponentDelegator delegator, Self self, Positive<VodNetwork> network, Positive<Timer> timer, VideoNeighbours neighbours, Map<Integer, EncodedSubPiece> subPieces) {
// Algorithm specific
// fanout f = ln(system size) + constant
f = ((int) Math.log(500)) + 2;
subPiecesToPropose = new HashSet<Integer>();
subPiecesDelivered = new HashSet<EncodedSubPiece>();
requestedSubPieces = new HashSet<Integer>();
// References
this.delegator = delegator;
this.self = self;
this.network = network;
this.timer = timer;
this.neighbours = neighbours;
this.subPieces = subPieces;
// Configuration
ulBwCapacity = LSConfig.VIDEO_UPLOAD_CAPACITY; // in bytes
dlBwCapacity = Integer.MAX_VALUE;
uploaded = 0;
downloaded = 0;
}
示例2: VideoNeighbours
import se.sics.kompics.Positive; //导入依赖的package包/类
public VideoNeighbours(RetryComponentDelegator delegator, Self self, Positive<VodNetwork> network, boolean source) {
// Video references
this.delegator = delegator;
this.self = self;
this.network = network;
// Collections
croupierSample = new ArrayList<VodDescriptor>();
interAsSample = new ArrayList<VodDescriptor>();
closeNeighbours = new ArrayList<VodAddress>();
randomNeighbours = new ArrayList<VodAddress>();
// Tools
random = new Random(LSConfig.getSeed());
comparator = new VideoComparator(self);
// Inter-AS balancing -- if set to true a connection request
// to a random peer is sent the next round
incRandomIn = false;
// Connection configuration and statistics
maxOutConnectionsClose = LSConfig.VIDEO_MAX_OUT_CLOSE;
maxOutConnectionsRandom = source ? LSConfig.VIDEO_SOURCE_MAX_OUT_RANDOM : LSConfig.VIDEO_MAX_OUT_RANDOM;
ingoingClose = 0;
ingoingRandom = 0;
this.source = source;
// Connection timeouts, only necessary for outgoing
outgoingCloseTimeouts = new HashMap<VodAddress, Long>();
outgoingRandomTimeouts = new HashMap<VodAddress, Long>();
}
示例3: RespawnerComponent
import se.sics.kompics.Positive; //导入依赖的package包/类
public RespawnerComponent(RespawnerInit init) {
final Positive<Network> net = requires(Network.class);
self = init.self;
Handler<Start> startHandler = new Handler<Start>() {
@Override
public void handle(Start event) {
System.out.println("Started (" + netAddr + ").");
byte id = self.getId()[0];
byte newId = (byte) (id + 1);
if (newId < NUM_SPAWNS) {
trigger(new StartVNode(self, netAddr, new byte[]{newId}, schema), net);
TestUtil.submit(SPAWN_SENT);
}
trigger(new StopVNode(self, self), net);
}
};
subscribe(startHandler, control);
}
示例4: report
import se.sics.kompics.Positive; //导入依赖的package包/类
/**
*
* @param component
* @param network
* @param selfAddress the client's address
* @param portUsed by the client that is reporting the issue
* @param target destination address for the issue being reported
* @param success was the issue a problem or a success
* @param timeTaken how long did the issue take?
* @param msg textual description of the report
*/
public static void report(RetryComponentDelegator component, Positive<VodNetwork> network,
VodAddress selfAddress, int portUsed, VodAddress target, boolean success, long timeTaken,
String msg) {
if (portUsed < 0 || portUsed > 65535) {
throw new IllegalArgumentException("portUsed must be in the range 0..65535");
}
if (timeTaken < 0) {
throw new IllegalArgumentException("timeTaken must be greater than 0.");
}
if (msg.length() > 65535) {
throw new IllegalArgumentException("msg should be less than 65535 chars.");
}
NatReportMsg.NatReport nr = new NatReportMsg.NatReport(portUsed, target, success,
timeTaken, msg);
List<NatReportMsg.NatReport> nrs = new ArrayList<NatReportMsg.NatReport>();
nrs.add(nr);
Address bAddr = VodConfig.getBootstrapServer();
if (bAddr != null) {
VodAddress dest = ToVodAddr.bootstrap(bAddr);
NatReportMsg evt = new NatReportMsg(selfAddress, dest, nrs);
component.doTrigger(evt, network);
}
}
示例5: ExtPort
import se.sics.kompics.Positive; //导入依赖的package包/类
public ExtPort(Positive<Timer> timerPort, Positive<Network> networkPort, Positive<CroupierPort> croupierPort,
Negative<OverlayViewUpdatePort> viewUpdatePort) {
this.networkPort = networkPort;
this.timerPort = timerPort;
this.croupierPort = croupierPort;
this.viewUpdatePort = viewUpdatePort;
}
示例6: ComponentBodyAdapter
import se.sics.kompics.Positive; //导入依赖的package包/类
ComponentBodyAdapter(ResolutionContext context, JDefinedClass clazz) {
super(context, clazz);
initBlock = clazz.instanceInit();
handlerType = (JClass) context.unit._ref(Handler.class);
posPortType = (JClass) context.unit._ref(Positive.class);
negPortType = (JClass) context.unit._ref(Negative.class);
componentType = (JClass) context.unit._ref(Component.class);
initType = (JClass) context.unit._ref(Init.class);
}
示例7: VideoGossip
import se.sics.kompics.Positive; //导入依赖的package包/类
public VideoGossip(RetryComponentDelegator delegator, Self self, Positive<VodNetwork> network, Positive<Timer> timer, VideoNeighbours neighbours, Map<Integer, EncodedSubPiece> subPieceBuffer, Set<TimeoutId> timeoutIds, boolean source) {
// Algorithm specific
// fanout f = ln(system size) + constant
//f = ((int) Math.log(500)) + 2;
subPiecesToPropose = new HashSet<Integer>();
requestedSubPieces = new HashSet<Integer>();
// References
this.delegator = delegator;
this.self = self;
this.network = network;
this.timer = timer;
this.neighbours = neighbours;
this.subPiecesDelivered = subPieceBuffer;
// Retransmission
currentRequests = new HashMap<Integer, Integer>();
piecesProviders = new HashMap<Integer, BlockingQueue<VodAddress>>();
this.timeoutIds = timeoutIds;
// Configuration
if (source) {
ulBwCapacity = LSConfig.VIDEO_SOURCE_UPLOAD_CAPACITY;
f = 5;
} else {
ulBwCapacity = LSConfig.VIDEO_UPLOAD_CAPACITY; // in bytes
f = 8;
}
dlBwCapacity = Integer.MAX_VALUE;
uploaded = 0;
downloaded = 0;
highUploadWarning = false;
this.source = source;
random = new Random(LSConfig.getSeed());
}
示例8: SenderComponent
import se.sics.kompics.Positive; //导入依赖的package包/类
public SenderComponent(SenderInit init) {
final Positive<Network> net = requires(Network.class);
self = init.self;
Handler<Start> startHandler = new Handler<Start>() {
@Override
public void handle(Start event) {
System.out.println("Started (" + self + ").");
trigger(new TestMsg(self, self), net);
TestUtil.submit(MSG_SENT);
}
};
subscribe(startHandler, control);
}
示例9: DataNetwork
import se.sics.kompics.Positive; //导入依赖的package包/类
public DataNetwork(Init init) {
Component dataInterceptorC = create(DataStreamInterceptor.class, Init.NONE);
Component networkC = init.hook.setupNetwork(proxy);
init.hook.connectTimer(proxy, dataInterceptorC);
Positive<Network> nettyPort = networkC.getPositive(Network.class);
Negative<Network> interceptorPortReq = dataInterceptorC.getNegative(Network.class);
Positive<Network> interceptorPortProv = dataInterceptorC.getPositive(Network.class);
connect(nettyPort, interceptorPortReq, Channel.TWO_WAY);
connect(interceptorPortProv, net, new DataSelector(), Channel.ONE_WAY_POS);
connect(interceptorPortProv, net, new DataNotifySelector(), Channel.ONE_WAY_POS);
connect(nettyPort, net, new NotDataSelector(), Channel.ONE_WAY_POS);
connect(nettyPort, net, new NotDataNotifySelector(), Channel.ONE_WAY_POS);
connect(nettyPort, net, Channel.ONE_WAY_NEG);
}
示例10: connect
import se.sics.kompics.Positive; //导入依赖的package包/类
public static VirtualNetworkChannel connect(Positive<Network> sourcePort, Negative<Network> deadLetterBox) {
VirtualNetworkChannel vnc = new VirtualNetworkChannel(sourcePort, deadLetterBox);
sourcePort.addChannel(vnc);
deadLetterBox.addChannel(vnc);
return vnc;
}
示例11: ThreePhaseGossipRetransmission
import se.sics.kompics.Positive; //导入依赖的package包/类
public ThreePhaseGossipRetransmission(RetryComponentDelegator delegator, Self self, Positive<VodNetwork> network, Positive<Timer> timer, VideoNeighbours neighbours, Map<Integer, EncodedSubPiece> subPieceBuffer) {
super(delegator, self, network, timer, neighbours, subPieceBuffer);
currentRequests = new HashMap<Integer, Integer>();
}
示例12: setTimer
import se.sics.kompics.Positive; //导入依赖的package包/类
void setTimer(Positive<Timer> timer) {
this.timer = timer;
}
示例13: getTimer
import se.sics.kompics.Positive; //导入依赖的package包/类
public Positive<Timer> getTimer() {
return timer;
}
示例14: setFailureDetector
import se.sics.kompics.Positive; //导入依赖的package包/类
void setFailureDetector(Positive<EventualFailureDetector> fd) {
this.fd = fd;
}
示例15: setLookup
import se.sics.kompics.Positive; //导入依赖的package包/类
public void setLookup(Positive<LookupService> lookup) {
this.lookup = lookup;
}