本文整理汇总了Java中org.objectweb.proactive.core.body.request.Request类的典型用法代码示例。如果您正苦于以下问题:Java Request类的具体用法?Java Request怎么用?Java Request使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Request类属于org.objectweb.proactive.core.body.request包,在下文中一共展示了Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Client
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Constructs the client object from given client subject.
* @param subject with the name of the client authenticated in the resource manager (can be null)
* @param pingable defines if client has to be pinged
*/
public Client(Subject subject, boolean pingable) {
this.subject = subject;
this.pingable = pingable;
if (subject != null) {
UserNamePrincipal unPrincipal = subject.getPrincipals(UserNamePrincipal.class).iterator().next();
this.name = unPrincipal.getName();
}
if (pingable) {
Request r = PAActiveObject.getContext().getCurrentRequest();
this.id = r.getSourceBodyID();
this.url = r.getSender().getNodeURL() + "/" + this.id.shortString();
this.body = r.getSender();
}
}
示例2: processRequest
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Processes the request and returns true if the request can be discarded
* after processing.
* @param request the request to process
* @return true if the request can be discarded (removed from the
* container it is stored), false if it has to be kept.
*/
public int processRequest(Request request) {
if (counter == 0) {
// first call
numberOfRequests = requestQueue.size();
}
counter++;
int shouldRemove;
if (selectorRequestFilter.acceptRequest(request)) {
requestToServe = request;
shouldRemove = REMOVE;
} else {
shouldRemove = KEEP;
}
if ((counter == numberOfRequests) && (requestToServe != null)) {
if (request == requestToServe) {
return REMOVE_AND_SERVE;
} else {
body.serve(requestToServe); // serve an already removed request
}
}
return shouldRemove;
}
示例3: serve
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Serves the request. The request should be removed from the request queue before serving,
* which is correctly done by all methods of the Service class. However, this condition is
* not ensured for custom calls on serve.
*/
public void serve(Request request) {
if (Profiling.TIMERS_COMPILED) {
TimerWarehouse.startServeTimer(bodyID, request.getMethodCall().getReifiedMethod());
}
// push the new context
LocalBodyStore.getInstance().pushContext(new Context(BodyImpl.this, request));
try {
serveInternal(request, null);
} finally {
LocalBodyStore.getInstance().popContext();
}
if (Profiling.TIMERS_COMPILED) {
TimerWarehouse.stopServeTimer(BodyImpl.this.bodyID);
}
}
示例4: serveWithException
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Serves the request with the given exception as result instead of the normal execution.
* The request should be removed from the request queue before serving,
* which is correctly done by all methods of the Service class. However, this condition is
* not ensured for custom calls on serve.
*/
public void serveWithException(Request request, Throwable exception) {
// Sterility control
// If the methodCall is sterile, the body must be sterile during its service
if (request != null && request.getMethodCall() != null && request.getMethodCall().isSterile()) {
setSterility(true, request.getSender().getID());
}
// Serve
if (this.ftmanager != null) {
this.ftmanager.onServeRequestBefore(request);
this.localBodyStrategy.serveWithException(request, exception);
this.ftmanager.onServeRequestAfter(request);
} else {
this.localBodyStrategy.serveWithException(request, exception);
}
// Sterility control
// Once the service of a sterile methodCall is done, the body can be turned back to standard
// mode
this.setSterility(false, null);
}
示例5: onServeRequestBefore
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
@Override
public int onServeRequestBefore(Request request) {
// checkpoint if needed
while (this.haveToCheckpoint()) {
this.checkpoint(request);
}
// update the last served request index only if needed
if (FTManagerCIC.isOCEnable) {
MessageInfo mi = request.getMessageInfo();
if (mi != null) {
long requestIndex = ((MessageInfoCIC) (mi)).positionInHistory;
if (this.lastServedRequestIndex.getValue() < requestIndex) {
this.lastServedRequestIndex.setValue(requestIndex);
}
}
}
return 0;
}
示例6: updateAwaitedRequests
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
private boolean updateAwaitedRequests(Request r) {
AwaitedRequest ar = null;
Iterator<AwaitedRequest> it = this.awaitedRequests.iterator();
while (it.hasNext()) {
AwaitedRequest arq = (it.next());
if ((arq.getAwaitedSender()).equals(r.getSourceBodyID())) {
ar = arq;
break;
}
}
if (ar != null) {
//System.err.println(""+ this.ownerID + " Request is updated by " + r.getSourceBodyID());
ar.setAwaitedRequest(r);
this.awaitedRequests.remove(ar);
return true;
} else {
return false;
}
}
示例7: filterQueue
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
private void filterQueue(BlockingRequestQueue queue, CheckpointInfoCIC cic) {
CircularArrayList<Request> internalQueue = ((BlockingRequestQueueImpl) queue).getInternalQueue();
ListIterator<Request> itQueue = internalQueue.listIterator();
while (itQueue.hasNext()) {
Request current = (itQueue.next());
MessageInfoCIC mi = (MessageInfoCIC) current.getMessageInfo();
if (mi == null) {
// is request an awaited or a non ft ?
if (current instanceof AwaitedRequest) {
// current is an awaited request that is not updated
this.awaitedRequests.add((AwaitedRequest) current);
}
} else if (mi.isOrphanFor <= cic.checkpointIndex) {
// current is an orpahn request
// System.out.println("" + this.ownerID + " is filtering some orphan requests ...");
AwaitedRequest ar = new AwaitedRequest(current.getSourceBodyID());
itQueue.set(ar);
this.awaitedRequests.add(ar);
}
}
}
示例8: onSendRequestAfter
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
@Override
public int onSendRequestAfter(Request request, int rdvValue, UniversalBody destination)
throws RenegotiateSessionException, CommunicationForbiddenException {
if (rdvValue == FTManagerCIC.RESEND_MESSAGE) {
try {
request.resetSendCounter();
request.setIgnoreIt(false);
Thread.sleep(FTManager.TIME_TO_RESEND);
int rdvValueBis = sendRequest(request, destination);
return this.onSendRequestAfter(request, rdvValueBis, destination);
} catch (RenegotiateSessionException e1) {
throw e1;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return 0;
}
示例9: reify
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
public Object reify(MethodCall c) throws Throwable {
Request r = new RequestImpl(c, c.isOneWayCall());
SynchronousReplyImpl reply = (SynchronousReplyImpl) this.remoteObject.receiveMessage(r);
if (reply != null) {
MethodCallResult rr = reply.getResult();
if (rr.getException() != null) {
throw rr.getException();
}
return reply.getResult().getResult();
}
return null;
}
示例10: getAdapterClass
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
public Class<?> getAdapterClass() {
try {
MethodCall mc = MethodCall.getMethodCall(methods[5], new Object[0],
new HashMap<TypeVariable<?>, Class<?>>());
Request r = new RemoteObjectRequest(mc);
SynchronousReplyImpl reply = (SynchronousReplyImpl) this.receiveMessage(r);
return (Class<?>) reply.getResult().getResult();
} catch (Exception e) {
LOGGER_RO
.info(displayCaller +
" : exception in remote object adapter while forwarding the method call to" +
displayROURI, e);
}
return null;
}
示例11: onDeliverRequest
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Message must be synchronously logged before being delivered.
* The LatestRcvdIndex table is updated
* @see org.objectweb.proactive.core.body.ft.protocols.FTManager#onReceiveRequest(org.objectweb.proactive.core.body.request.Request)
*/
@Override
public int onDeliverRequest(Request request) {
// if the ao is recovering, message are not logged
if (!this.isRecovering) {
try {
// log the message
this.storage.storeRequest(this.ownerID, request);
// update latestIndex table
this.updateLatestRvdIndexTable(request);
} catch (RemoteException e) {
e.printStackTrace();
}
}
return 0;
}
示例12: acceptRequest
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public boolean acceptRequest(final Request request) {
// We find all the requests which can't be served yet
String name = request.getMethodName();
if (name.equals("waitAny")) {
return false;
} else if (name.equals("waitAll")) {
return false;
}
return true;
}
示例13: getOldest
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Returns the oldest request whose method name is s or null if no match
* The request queue is unchanged by this call
* @param methodName the name of the method to look for
* @return the oldest matching request or null
* @throws NoSuchMethodError if methodName is not a public method of the reified object.
*/
public Request getOldest(String methodName) {
if (!this.body.checkMethod(methodName)) {
throw new NoSuchMethodError(methodName + " is not defined in " +
this.body.getReifiedObject().getClass().getName());
}
return requestQueue.getOldest(methodName);
}
示例14: blockingGetOldest
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Returns the oldest request from the queue
* If no request is available the method block until one request can be returned
* The request queue is unchanged by this call
* @return the oldest request or null
*/
public Request blockingGetOldest() {
Request request = null;
while ((request == null) && !requestQueue.isDestroyed()) {
waitForRequest();
request = requestQueue.getOldest();
}
return request;
}
示例15: getYoungest
import org.objectweb.proactive.core.body.request.Request; //导入依赖的package包/类
/**
* Returns the youngest request whose method name is s or null if no match
* The request queue is unchanged by this call
* @param methodName the name of the method to look for
* @return the youngest matching request or null
* @throws NoSuchMethodError if methodName is not a public method of the reified object.
*/
public Request getYoungest(String methodName) {
if (!this.body.checkMethod(methodName)) {
throw new NoSuchMethodError(methodName + " is not defined in " +
this.body.getReifiedObject().getClass().getName());
}
return requestQueue.getYoungest(methodName);
}