@Test public void buildChildSelfLink() throws Throwable { SomeFactoryService f = new SomeFactoryService(); f = (SomeFactoryService) this.host.startServiceAndWait(f, UUID.randomUUID().toString(), null); String idHash = Utils.computeHash(this.host.getId()); assertTrue(f.buildDefaultChildSelfLink().startsWith(idHash)); long s = System.nanoTime(); for (int i = 0; i < this.iterationCount; i++) { assertTrue(f.buildDefaultChildSelfLink() != null); } long e = System.nanoTime(); double thpt = (double) this.iterationCount / (e - s); thpt *= TimeUnit.SECONDS.toNanos(1); this.host.log("throughput (calls/sec) %f", thpt); s = System.nanoTime(); for (int i = 0; i < this.iterationCount; i++) { assertTrue(UUID.randomUUID().toString() != null); } e = System.nanoTime(); thpt = (double) this.iterationCount / (e - s); thpt *= TimeUnit.SECONDS.toNanos(1); this.host.log("UUID.randomUUID().toString() throughput (calls/sec) %f", thpt); }
protected String buildDefaultChildSelfLink() { return getHost().nextUUID(); }
FactoryService extends StatelessService { protected String buildDefaultChildSelfLink() { return getHost().nextUUID(); } }
FactoryService extends StatelessService { protected String buildDefaultChildSelfLink() { return getHost().nextUUID(); } FactoryService(Class<? extends ServiceDocument> childServiceDocumentType); }
FactoryService extends StatelessService { protected String buildDefaultChildSelfLink() { return getHost().nextUUID(); } FactoryService(Class<? extends ServiceDocument> childServiceDocumentType); static FactoryService create(Class<? extends Service> childServiceType,
            ServiceOption... options); static FactoryService create(Class<? extends Service> childServiceType,
            Class<? extends ServiceDocument> childServiceDocumentType, ServiceOption... options); static FactoryService createIdempotent(Class<? extends Service> childServiceType); static FactoryService createIdempotent(Class<? extends Service> childServiceType,
            Class<? extends ServiceDocument> childServiceDocumentType); void setSelfQueryResultLimit(int limit); int getSelfQueryResultLimit(); void setUseBodyForSelfLink(boolean useBody); boolean hasChildOption(ServiceOption option); @Override void handleStart(Operation startPost); @Override void authorizeRequest(Operation op); @Override void handleRequest(Operation op); @Override void handleRequest(Operation op, OperationProcessingStage opProcessingStage); @Override void handleStop(Operation op); @Override void handleGet(Operation get); void completeGetWithQuery(Operation op, EnumSet<ServiceOption> caps); @Override void handleOptions(Operation op); @Override void handlePost(Operation op); @Override void toggleOption(ServiceOption option, boolean enable); @Override String getPeerNodeSelectorPath(); @Override void setPeerNodeSelectorPath(String link); @Override URI getUri(); @Override ServiceDocument getDocumentTemplate(); @Override void handleConfigurationRequest(Operation request); @Override void handleNodeGroupMaintenance(Operation maintOp); abstract Service createServiceInstance(); }
FactoryService extends StatelessService { protected String buildDefaultChildSelfLink() { return getHost().nextUUID(); } FactoryService(Class<? extends ServiceDocument> childServiceDocumentType); static FactoryService create(Class<? extends Service> childServiceType,
            ServiceOption... options); static FactoryService create(Class<? extends Service> childServiceType,
            Class<? extends ServiceDocument> childServiceDocumentType, ServiceOption... options); static FactoryService createIdempotent(Class<? extends Service> childServiceType); static FactoryService createIdempotent(Class<? extends Service> childServiceType,
            Class<? extends ServiceDocument> childServiceDocumentType); void setSelfQueryResultLimit(int limit); int getSelfQueryResultLimit(); void setUseBodyForSelfLink(boolean useBody); boolean hasChildOption(ServiceOption option); @Override void handleStart(Operation startPost); @Override void authorizeRequest(Operation op); @Override void handleRequest(Operation op); @Override void handleRequest(Operation op, OperationProcessingStage opProcessingStage); @Override void handleStop(Operation op); @Override void handleGet(Operation get); void completeGetWithQuery(Operation op, EnumSet<ServiceOption> caps); @Override void handleOptions(Operation op); @Override void handlePost(Operation op); @Override void toggleOption(ServiceOption option, boolean enable); @Override String getPeerNodeSelectorPath(); @Override void setPeerNodeSelectorPath(String link); @Override URI getUri(); @Override ServiceDocument getDocumentTemplate(); @Override void handleConfigurationRequest(Operation request); @Override void handleNodeGroupMaintenance(Operation maintOp); abstract Service createServiceInstance(); static final String PROPERTY_NAME_MAX_SYNCH_RETRY_COUNT; static final int MAX_SYNCH_RETRY_COUNT; static final Integer SELF_QUERY_RESULT_LIMIT; }