Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
papousek committed Apr 27, 2013
1 parent 62a8bd4 commit 140068c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public M get(long timeout, TimeUnit unit) throws InterruptedException, Execution

@Override
public synchronized void done(UUID node, Mergeable event) {
LOGGER.info("merging partial result from " + node);
if (partial == null) {
LOGGER.debug("the first partial result is " + event);
partial = (M) event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public void finished(UUID node, Mergeable event) {
LOGGER.error("Can't destroy the remote computation.", e);
}
}
LOGGER.info("destroying computatation: " + id);
try {
UnicastRemoteObject.unexportObject(remoteStatus, true);
} catch (NoSuchObjectException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sybila.parasim.computation.lifecycle.api.Computation;
import org.sybila.parasim.computation.lifecycle.api.Emitter;
import org.sybila.parasim.computation.lifecycle.api.MutableStatus;
import org.sybila.parasim.computation.lifecycle.api.Offerer;
import org.sybila.parasim.computation.lifecycle.api.ProgressAdapter;
import org.sybila.parasim.computation.lifecycle.api.RemoteQueue;
import org.sybila.parasim.computation.lifecycle.api.annotations.ComputationScope;
import org.sybila.parasim.computation.lifecycle.api.annotations.Node;
Expand All @@ -46,6 +49,7 @@
import org.sybila.parasim.core.api.Context;
import org.sybila.parasim.core.api.enrichment.Enrichment;
import org.sybila.parasim.core.impl.remote.RemoteConfiguration;
import org.sybila.parasim.model.Mergeable;

/**
* @author <a href="mailto:xpapous1@fi.muni.cz">Jan Papousek</a>
Expand All @@ -56,6 +60,8 @@ public class RemoteExecutorImpl implements RemoteExecutor {
private final Map<UUID, Context> contexts = new HashMap<>();
private final UUID id = UUID.randomUUID();

private static final Logger LOGGER = LoggerFactory.getLogger(RemoteExecutorImpl.class);

// for proxies
protected RemoteExecutorImpl() {
this.context = null;
Expand Down Expand Up @@ -134,6 +140,7 @@ private void initServices(Class<? extends Computation> computationClass, Context
// add progress listeners
localStatus.addProgressListerner(offerer);
localStatus.addProgressListerner(mucker);
localStatus.addProgressListerner(new LogListener(offerer));

// bind services
binder.bind(MutableStatus.class, Default.class, localStatus);
Expand All @@ -147,4 +154,19 @@ private void initServices(Class<? extends Computation> computationClass, Context
binder.bind(UUID.class, Node.class, getId());
}

private static class LogListener extends ProgressAdapter {

private final Offerer offerer;

public LogListener(Offerer offerer) {
this.offerer = offerer;
}

@Override
public void done(UUID node, Mergeable event) {
LOGGER.info("current offerer size is: " + offerer.size());
}

}

}

0 comments on commit 140068c

Please sign in to comment.