Search in sources :

Example 1 with InetEndpoint

use of org.gradle.internal.remote.internal.inet.InetEndpoint in project gradle by gradle.

the class PersistentDaemonRegistry method store.

@Override
public void store(final DaemonInfo info) {
    final Address address = info.getAddress();
    final DaemonContext daemonContext = info.getContext();
    final byte[] token = info.getToken();
    final State state = info.getState();
    lock.lock();
    LOGGER.debug("Storing daemon address: {}, context: {}", address, daemonContext);
    try {
        cache.update(new PersistentStateCache.UpdateAction<DaemonRegistryContent>() {

            @Override
            public DaemonRegistryContent update(DaemonRegistryContent oldValue) {
                if (oldValue == null) {
                    // it means the registry didn't exist yet
                    oldValue = new DaemonRegistryContent();
                }
                DaemonInfo daemonInfo = new DaemonInfo(address, daemonContext, token, state);
                oldValue.removeInfo(((InetEndpoint) address).getPort());
                oldValue.setStatus(address, daemonInfo);
                return oldValue;
            }
        });
    } finally {
        lock.unlock();
    }
}
Also used : DaemonContext(org.gradle.launcher.daemon.context.DaemonContext) PersistentStateCache(org.gradle.cache.PersistentStateCache) InetEndpoint(org.gradle.internal.remote.internal.inet.InetEndpoint) Address(org.gradle.internal.remote.Address) State(org.gradle.launcher.daemon.server.api.DaemonStateControl.State)

Aggregations

PersistentStateCache (org.gradle.cache.PersistentStateCache)1 Address (org.gradle.internal.remote.Address)1 InetEndpoint (org.gradle.internal.remote.internal.inet.InetEndpoint)1 DaemonContext (org.gradle.launcher.daemon.context.DaemonContext)1 State (org.gradle.launcher.daemon.server.api.DaemonStateControl.State)1