/** * Call a method that must use a secure * transport under the hood. */ public IFuture<Void> method2(String msg) { ServiceCall sc = ServiceCall.getCurrentInvocation(); System.out.println("Called method2: "+msg+" "+sc+" "+Thread.currentThread()); return IFuture.DONE; } }
/** * Call a method that must use a secure * transport under the hood. */ public IFuture<Void> method(String msg) { ServiceCall sc = ServiceCall.getCurrentInvocation(); Future<Void> ret = new Future<Void>(); return ret; }
/** * Allow calling a method only from an authenticated user. */ // @Authenticated(names={"VSISSTAFF17", "Alex-PC-neu", "Lars-PC", "willi", "hans"}) @Authenticated(virtuals="testuser") public IFuture<Void> method(String msg) { ServiceCall sc = ServiceCall.getCurrentInvocation(); // System.out.println("Called method: "+msg+" "+sc.getTimeout() // +" "+sc.isRealtime()+" "+sc.getProperties()); return IFuture.DONE; } }
/** * Call a method that must use a secure * transport under the hood. */ public IFuture<Void> method(String msg) { ServiceCall sc = ServiceCall.getCurrentInvocation(); // System.out.println("Called method: "+msg+" "+sc.getTimeout() // +" "+sc.isRealtime()+" "+sc.getProperties()); Future<Void> ret = new Future<Void>(); return ret; // return IFuture.DONE; } }
public void customResultAvailable(ITestService ts) { System.out.println("Called method1 after search: "+ServiceCall.getCurrentInvocation()+" "+Thread.currentThread()); ts.method2(msg).addResultListener(new DelegationResultListener<Void>(ret) { public void customResultAvailable(Void result) { ServiceCall sc = ServiceCall.getCurrentInvocation(); System.out.println("Called service: "+msg+" "+sc+" "+Thread.currentThread()); ret.setResult(null); } }); } });
/** * Post a status change. * @param status The new status. */ public IFuture<Void> status(String nick, String status, byte[] image) { publishEvent(ChatEvent.TYPE_STATECHANGE, nick, ServiceCall.getCurrentInvocation().getCaller(), status, false, image); return IFuture.DONE; }
/** * Post a status change. * @param status The new status. */ public IFuture<Void> status(String nick, String status, byte[] image) { publishEvent(ChatEvent.TYPE_STATECHANGE, nick, ServiceCall.getCurrentInvocation().getCaller(), status, false, image); return IFuture.DONE; }
/** * Post a message * @param text The text message. */ public IFuture<Void> message(String nick, String text, boolean privatemessage) { // System.out.println("Timeout: "+ServiceCall.getInstance().getTimeout()+", "+ServiceCall.getInstance().isRealtime()); boolean published = publishEvent(ChatEvent.TYPE_MESSAGE, nick, ServiceCall.getCurrentInvocation().getCaller(), text, privatemessage, null); return published ? IFuture.DONE : new Future<Void>(new RuntimeException("No GUI, message was discarded.")); }
/** * Post a message * @param text The text message. */ public IFuture<Void> message(String nick, String text, boolean privatemessage) { // System.out.println("Timeout: "+ServiceCall.getInstance().getTimeout()+", "+ServiceCall.getInstance().isRealtime()); boolean published = publishEvent(ChatEvent.TYPE_MESSAGE, nick, ServiceCall.getCurrentInvocation().getCaller(), text, privatemessage, null); return published ? IFuture.DONE : new Future<Void>(new RuntimeException("No GUI, message was discarded.")); }
/** * Get the non functional props from the executed call. * @return The call props. */ protected Map<String, Object> getNFProps(boolean intermediate) { // if(method.getName().indexOf("method")!=-1) // System.out.println("aas"); Map<String, Object> ret = nonfunc; // During intermediate results the call is still running and nf vals must be fetched from current invoc ServiceCall sc = intermediate? ServiceCall.getCurrentInvocation(): ServiceCall.getLastInvocation(); if(sc!=null) ret = sc.getProperties(); return ret; } }
/** * */ protected void doCall(final Future<?> ret) { // SFuture.avoidCallTimeouts(ret, agent.getExternalAccess()); ServiceCall sc = ServiceCall.getCurrentInvocation(); long to = sc.getTimeout(); System.out.println("Timeout is: " + to); final long wait = to>0? to*2: 0; final long startwait = System.currentTimeMillis(); // System.out.println("waiting: "+wait+", "+System.currentTimeMillis()); agent.getComponentFeature(IExecutionFeature.class).waitForDelay(wait, new IComponentStep<Void>() { public IFuture<Void> execute(IInternalAccess ia) { System.out.println("waited: "+ (System.currentTimeMillis() - startwait)); ret.setResultIfUndone(null); return IFuture.DONE; } }); } }
ServiceCall sc = ServiceCall.getCurrentInvocation(); System.out.println("Called method1: "+msg+" "+sc+" "+Thread.currentThread());
/** * Automatically update the timer of a long running service call future. * Ensures that the caller does not timeout even if no result * value is set in that time span. * The call periodically sends alive calls to the caller. * @param ret The future that is returned by the service call. * @param ia The component handling the service call (on that component the periodic updates are scheduled). */ public static void avoidCallTimeouts(final Future<?> ret, IInternalAccess ia) { ServiceCall sc = ServiceCall.getCurrentInvocation(); long to = sc!=null? sc.getTimeout(): BasicService.getLocalDefaultTimeout(); // Hack!!! find out in which cases service call can null boolean realtime = sc!=null ? sc.getRealtime()!=null ? sc.getRealtime().booleanValue() : false : false; // boolean local = sc.getCaller().getPlatformName().equals(agent.getComponentIdentifier().getPlatformName()); // long to = sc.getTimeout()>0? sc.getTimeout(): (local? BasicService.DEFAULT_LOCAL: BasicService.DEFAULT_REMOTE); // to = 5000; avoidCallTimeouts(ret, ia, to, realtime); }
/** * Call a method that must use a secure * transport under the hood. */ public IFuture<Void> method(String msg) { ServiceCall sc = ServiceCall.getCurrentInvocation(); System.out.println("Called method: "+msg+" "+sc.getTimeout() +" "+sc.isRealtime()+" "+sc.getProperties()); sc.setProperty("extra", "someotherval"); sc.setProperty("new", "new"); // Future<Void> ret = new Future<Void>(); // return ret; return IFuture.DONE; } }
/** * Automatically update the timer of a long running service call future. * Ensures that the caller does not timeout even if no result * value is set in that timespan. * The call periodically sends alive calls to the caller. * @param ret The future that is returned by the service call. * @param ea The component handling the service call (on that component the periodic updates are scheduled). */ public static void avoidCallTimeouts(final Future<?> ret, IExternalAccess ea) { ServiceCall sc = ServiceCall.getCurrentInvocation(); long to = sc!=null? sc.getTimeout(): BasicService.getLocalDefaultTimeout(); // Hack!!! find out in which cases service call can null boolean realtime = sc!=null ? sc.getRealtime()!=null ? sc.getRealtime().booleanValue() : false : false; // boolean local = sc.getCaller().getPlatformName().equals(agent.getComponentIdentifier().getPlatformName()); // long to = sc.getTimeout()>0? sc.getTimeout(): (local? BasicService.DEFAULT_LOCAL: BasicService.DEFAULT_REMOTE); // to = 5000; avoidCallTimeouts(ret, ea, to, realtime); }
/** * Automatically update the timer of a long running service call future. * Ensures that the caller does not timeout even if no result * value is set in that time span. * The call periodically sends alive calls to the caller. * @param ret The future that is returned by the service call. * @param ia The component handling the service call (on that component the periodic updates are scheduled). */ public static void avoidCallTimeouts(final Future<?> ret, IInternalAccess ia) { ServiceCall sc = ServiceCall.getCurrentInvocation(); long to = sc!=null? sc.getTimeout(): Starter.getLocalDefaultTimeout(ia.getComponentIdentifier()); // Hack!!! find out in which cases service call can null boolean realtime = sc!=null ? sc.getRealtime()!=null ? sc.getRealtime().booleanValue() : false : false; // boolean local = sc.getCaller().getPlatformName().equals(agent.getComponentIdentifier().getPlatformName()); // long to = sc.getTimeout()>0? sc.getTimeout(): (local? BasicService.DEFAULT_LOCAL: BasicService.DEFAULT_REMOTE); // to = 5000; avoidCallTimeouts(ret, ia, to, realtime); }
/** * Automatically update the timer of a long running service call future. * Ensures that the caller does not timeout even if no result * value is set in that timespan. * The call periodically sends alive calls to the caller. * @param ret The future that is returned by the service call. * @param ea The component handling the service call (on that component the periodic updates are scheduled). */ public static void avoidCallTimeouts(final Future<?> ret, IExternalAccess ea) { ServiceCall sc = ServiceCall.getCurrentInvocation(); long to = sc!=null? sc.getTimeout(): Starter.getLocalDefaultTimeout(ea.getComponentIdentifier()); // Hack!!! find out in which cases service call can null boolean realtime = sc!=null ? sc.getRealtime()!=null ? sc.getRealtime().booleanValue() : false : false; // boolean local = sc.getCaller().getPlatformName().equals(agent.getComponentIdentifier().getPlatformName()); // long to = sc.getTimeout()>0? sc.getTimeout(): (local? BasicService.DEFAULT_LOCAL: BasicService.DEFAULT_REMOTE); // to = 5000; avoidCallTimeouts(ret, ea, to, realtime); }
final ServiceCall call = ServiceCall.getCurrentInvocation();
final ServiceCall call = ServiceCall.getCurrentInvocation();
final ServiceCall call = ServiceCall.getCurrentInvocation();