/** * Modify a component description. * @throws RuntimeException when the component is not registered. */ public IFuture<IDFComponentDescription> modify(IDFComponentDescription cdesc) { Future<IDFComponentDescription> ret = new Future<IDFComponentDescription>(); // Use clone to avoid caller manipulating object after insertion. IDFComponentDescription clone = SFipa.cloneDFComponentDescription(cdesc, cms, this); // Change description, when valid. if(clone.getLeaseTime()==null || clone.getLeaseTime().getTime()>clockservice.getTime()) { // Automatically throws exception, when key does not exist. components.replace(clone.getName(), clone); //System.out.println("modified: "+clone.getName()); ret.setResult(clone); } else { //throw new RuntimeException("Invalid lease time: "+clone.getLeaseTime()); ret.setException(new RuntimeException("Invalid lease time: "+clone.getLeaseTime())); } return ret; }
/** * Modify a component description. * @throws RuntimeException when the component is not registered. */ public IFuture<IDFComponentDescription> modify(IDFComponentDescription cdesc) { Future<IDFComponentDescription> ret = new Future<IDFComponentDescription>(); // Use clone to avoid caller manipulating object after insertion. IDFComponentDescription clone = SFipa.cloneDFComponentDescription(cdesc, cms, this); // Change description, when valid. if(clone.getLeaseTime()==null || clone.getLeaseTime().getTime()>clockservice.getTime()) { // Automatically throws exception, when key does not exist. components.replace(clone.getName(), clone); //System.out.println("modified: "+clone.getName()); ret.setResult(clone); } else { //throw new RuntimeException("Invalid lease time: "+clone.getLeaseTime()); ret.setException(new RuntimeException("Invalid lease time: "+clone.getLeaseTime())); } return ret; }
/** * Modify a component description. * @throws RuntimeException when the component is not registered. */ public IFuture<IDFComponentDescription> modify(IDFComponentDescription cdesc) { Future<IDFComponentDescription> ret = new Future<IDFComponentDescription>(); // Use clone to avoid caller manipulating object after insertion. IDFComponentDescription clone = SFipa.cloneDFComponentDescription(cdesc, cms, this); // Change description, when valid. if(clone.getLeaseTime()==null || clone.getLeaseTime().getTime()>clockservice.getTime()) { // Automatically throws exception, when key does not exist. synchronized(components) { components.replace(clone.getName(), clone); } //System.out.println("modified: "+clone.getName()); ret.setResult(clone); } else { //throw new RuntimeException("Invalid lease time: "+clone.getLeaseTime()); ret.setException(new RuntimeException("Invalid lease time: "+clone.getLeaseTime())); } return ret; }