Search in sources :

Example 6 with DaemonInfo

use of org.gradle.launcher.daemon.registry.DaemonInfo in project gradle by gradle.

the class NotMostRecentlyUsedDaemonExpirationStrategy method isMostRecentlyUsed.

private boolean isMostRecentlyUsed(Collection<DaemonInfo> daemonInfos, DaemonContext thisDaemonContext) {
    String mruUid = null;
    Date mruTimestamp = new Date(Long.MIN_VALUE);
    for (DaemonInfo daemonInfo : daemonInfos) {
        Date daemonAccessTime = daemonInfo.getLastBusy();
        if (daemonAccessTime.after(mruTimestamp)) {
            mruUid = daemonInfo.getUid();
            mruTimestamp = daemonAccessTime;
        }
    }
    return thisDaemonContext.getUid().equals(mruUid);
}
Also used : DaemonInfo(org.gradle.launcher.daemon.registry.DaemonInfo) Date(java.util.Date)

Aggregations

DaemonInfo (org.gradle.launcher.daemon.registry.DaemonInfo)6 File (java.io.File)1 Collection (java.util.Collection)1 Date (java.util.Date)1 CountdownTimer (org.gradle.internal.time.CountdownTimer)1 DaemonContext (org.gradle.launcher.daemon.context.DaemonContext)1 InvalidateVirtualFileSystem (org.gradle.launcher.daemon.protocol.InvalidateVirtualFileSystem)1 ReportStatus (org.gradle.launcher.daemon.protocol.ReportStatus)1 Status (org.gradle.launcher.daemon.protocol.Status)1 DaemonDir (org.gradle.launcher.daemon.registry.DaemonDir)1 DaemonStopEvent (org.gradle.launcher.daemon.registry.DaemonStopEvent)1 DaemonStateControl (org.gradle.launcher.daemon.server.api.DaemonStateControl)1 DaemonExpirationResult (org.gradle.launcher.daemon.server.expiry.DaemonExpirationResult)1