Ejemplo n.º 1
0
 @SuppressWarnings("incomplete-switch")
 private void restart() {
   switch (state.get()) {
     case STARTING:
       Trace.debug(
           "Returning early from restart.  Already starting for project {0} and kind {1}",
           project.getName(), kind);
     case DISCONNECTED:
       Trace.debug(
           "Endpoint disconnected and skipping restart for project {0} and kind {1}",
           project.getName(), kind);
       return;
   }
   try {
     // TODO enhance fix to only check project once
     conn.refresh(project);
     Trace.debug(
         "WatchManager Rescheduling watch job for project {0} and kind {1}",
         project.getName(), kind);
     startWatch(project, backoff, lastConnect, this);
   } catch (Exception e) {
     Trace.debug(
         "WatchManager Unable to rescheduling watch job for project {0} and kind {1}",
         e, project.getName(), kind);
     stopWatch(project, conn);
   }
 }
Ejemplo n.º 2
0
 @Override
 public void error(Throwable err) {
   Trace.warn(
       "WatchManager Reconnecting. There was an error watching connection {0}: ",
       err, conn.toString());
   restart();
 }
Ejemplo n.º 3
0
 @Override
 public void connected(List<IResource> resources) {
   Trace.debug(
       "WatchManager Endpoint connected to {0} with {1} resources",
       conn.toString(), resources.size());
   this.resources.addAll(resources);
 }
Ejemplo n.º 4
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((connection == null) ? 0 : connection.hashCode());
   result = prime * result + ((project == null) ? 0 : project.hashCode());
   result = prime * result + ((kind == null) ? 0 : kind.hashCode());
   return result;
 }
Ejemplo n.º 5
0
 /* (non-Javadoc)
  * @see java.lang.Object#equals(java.lang.Object)
  */
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   WatchKey other = (WatchKey) obj;
   if (connection == null) {
     if (other.connection != null) return false;
   } else if (!connection.equals(other.connection)) return false;
   if (project == null) {
     if (other.project != null) return false;
   } else if (!project.equals(other.project)) return false;
   if (kind == null) {
     if (other.kind != null) return false;
   } else if (!kind.equals(other.kind)) return false;
   return true;
 }
Ejemplo n.º 6
0
 @Override
 public void disconnected() {
   Trace.debug("WatchManager Endpoint disconnected to {0}.", conn.toString());
   state.set(State.DISCONNECTED);
 }