/** * Returns a new Promise that has been resolved with the specified value. * * @param <T> The value type associated with the returned Promise. * @param value The value of the resolved Promise. * @return A new Promise which uses the default callback executor and * default scheduled executor that has been resolved with the * specified value. * @see PromiseFactory#resolved(Object) */ public static <T> Promise<T> resolved(T value) { return defaultFactory.resolved(value); }
/** * Returns a new Promise that has been resolved with the specified value. * * @param <T> The value type associated with the returned Promise. * @param value The value of the resolved Promise. * @return A new Promise which uses the default callback executor and * default scheduled executor that has been resolved with the * specified value. * @see PromiseFactory#resolved(Object) */ public static <T> Promise<T> resolved(T value) { return defaultFactory.resolved(value); }
/** * Returns a new Promise that has been resolved with the specified value. * * @param <T> The value type associated with the returned Promise. * @param value The value of the resolved Promise. * @return A new Promise which uses the default callback executor and * default scheduled executor that has been resolved with the * specified value. * @see PromiseFactory#resolved(Object) */ public static <T> Promise<T> resolved(T value) { return defaultFactory.resolved(value); }
/** * Returns a new Promise that has been resolved with the specified value. * * @param <T> The value type associated with the returned Promise. * @param value The value of the resolved Promise. * @return A new Promise which uses the default callback executor and * default scheduled executor that has been resolved with the * specified value. * @see PromiseFactory#resolved(Object) */ public static <T> Promise<T> resolved(T value) { return defaultFactory.resolved(value); }
/** * Returns a new Promise that has been resolved with the specified value. * * @param <T> The value type associated with the returned Promise. * @param value The value of the resolved Promise. * @return A new Promise which uses the default callback executor and * default scheduled executor that has been resolved with the * specified value. * @see PromiseFactory#resolved(Object) */ public static <T> Promise<T> resolved(T value) { return defaultFactory.resolved(value); }
/** * Returns a new Promise that has been resolved with the specified value. * * @param <T> The value type associated with the returned Promise. * @param value The value of the resolved Promise. * @return A new Promise which uses the default callback executor and * default scheduled executor that has been resolved with the * specified value. * @see PromiseFactory#resolved(Object) */ public static <T> Promise<T> resolved(T value) { return defaultFactory.resolved(value); }
/** * Returns a new Promise that has been resolved with the specified value. * * @param <T> The value type associated with the returned Promise. * @param value The value of the resolved Promise. * @return A new Promise which uses the default callback executor and * default scheduled executor that has been resolved with the * specified value. * @see PromiseFactory#resolved(Object) */ public static <T> Promise<T> resolved(T value) { return defaultFactory.resolved(value); }
@Override public Promise<Collection<Resource>> findProviders(RequirementExpression expression) { Set<Resource> providers = new HashSet<>(); dispatch(expression, providers); return promiseFactory.resolved(providers); }
@Override public Promise<Collection<Resource>> findProviders(RequirementExpression expression) { Set<Resource> providers = new HashSet<>(); dispatch(expression, providers); return promiseFactory.resolved(providers); }
private Promise<Long> doCall(PushEvent<T> event, PushEventConsumer< ? super T> pec) { return sameThread.resolved( Long.valueOf(System.nanoTime() + safePush(pec, event))); }
private Promise<Long> doCall(PushEvent<T> event, PushEventConsumer< ? super T> pec) { return sameThread.resolved( Long.valueOf(System.nanoTime() + safePush(pec, event))); }
private Promise<Long> doCall(PushEvent<T> event, PushEventConsumer< ? super T> pec) { return sameThread.resolved( Long.valueOf(System.nanoTime() + safePush(pec, event))); }
private synchronized Promise<BridgeRepository> load() throws Exception { lastModified = indexFile.lastModified(); if (indexFile.isFile()) { Set<Archive> toBeAdded = read(indexFile); Set<Archive> older = this.archives.keySet(); Set<Archive> toBeDeleted = new HashSet<>(older); toBeDeleted.removeAll(toBeAdded); toBeAdded.removeAll(older); archives.keySet() .removeAll(toBeDeleted); return update(toBeAdded); } else { return promiseFactory.resolved(new BridgeRepository()); } }
private synchronized Promise<BridgeRepository> load() throws Exception { lastModified = indexFile.lastModified(); if (indexFile.isFile()) { Set<Archive> toBeAdded = read(indexFile); Set<Archive> older = this.archives.keySet(); Set<Archive> toBeDeleted = new HashSet<>(older); toBeDeleted.removeAll(toBeAdded); toBeAdded.removeAll(older); archives.keySet() .removeAll(toBeDeleted); return update(toBeAdded); } else { return promiseFactory.resolved(new BridgeRepository()); } }
/** * @param artifacts * @param cycles * @param in * @return * @throws IOException * @throws XPathExpressionException */ private Promise<List<Artifact>> parseCompositeArtifacts(Set<URI> cycles, InputStream in, URI base) throws Exception { if (in == null) { logger.info("No such composite {}", base); return promiseFactory.resolved(Collections.emptyList()); } CompositeArtifacts ca = new CompositeArtifacts(in, base); ca.parse(); return getArtifacts(cycles, ca.uris); }
/** * @param artifacts * @param cycles * @param in * @return * @throws IOException * @throws XPathExpressionException */ private Promise<List<Artifact>> parseCompositeArtifacts(Set<URI> cycles, InputStream in, URI base) throws Exception { if (in == null) { logger.info("No such composite {}", base); return promiseFactory.resolved(Collections.emptyList()); } CompositeArtifacts ca = new CompositeArtifacts(in, base); ca.parse(); return getArtifacts(cycles, ca.uris); }
private Promise<List<Artifact>> parseArtifacts(InputStream in, URI uri) throws Exception { if (in == null) { logger.info("No content for {}", uri); return promiseFactory.resolved(Collections.emptyList()); } return promiseFactory.submit(() -> { try { ArtifactRepository ar = new ArtifactRepository(in, uri); return ar.getArtifacts(); } finally { IO.close(in); } }); }
@Override public Promise<Void> connectPromise() { synchronized (lock) { if (closed) { return closedConnectPromise(); } if (connected.isEmpty()) { if (connectPromise == null) { connectPromise = promiseFactory.deferred(); } return connectPromise.getPromise(); } else { return promiseFactory.resolved(null); } } }
@Override public Promise<Void> connectPromise() { synchronized (lock) { if (closed) { return closedConnectPromise(); } if (connected.isEmpty()) { if (connectPromise == null) { connectPromise = promiseFactory.deferred(); } return connectPromise.getPromise(); } else { return promiseFactory.resolved(null); } } }
private Promise<List<Artifact>> parseArtifacts(InputStream in, URI uri) throws Exception { if (in == null) { logger.info("No content for {}", uri); return promiseFactory.resolved(Collections.emptyList()); } return promiseFactory.submit(() -> { try { ArtifactRepository ar = new ArtifactRepository(in, uri); return ar.getArtifacts(); } finally { IO.close(in); } }); }