Skip to content

Commit

Permalink
Merge pull request #476 from jluhrs/feature/SEQNG-545
Browse files Browse the repository at this point in the history
Added debug messages to observe monitoring code.
  • Loading branch information
jluhrs authored Feb 15, 2018
2 parents 25c349d + 8932526 commit 9d6d665
Show file tree
Hide file tree
Showing 18 changed files with 189 additions and 112 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ lazy val edu_gemini_epics_acm = project
EpicsService,
GmpCommandsRecords,
Guava,
Slf4j,
"com.novocode" % "junit-interface" % "0.11" % "test"),
sourceGenerators in Compile += Def.task {
import scala.sys.process._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package edu.gemini.epics.acm;

import java.util.logging.Logger;

import edu.gemini.epics.EpicsReader;
import edu.gemini.epics.EpicsService;
import edu.gemini.epics.EpicsWriter;
Expand All @@ -17,10 +15,13 @@
import edu.gemini.epics.impl.EpicsWriterImpl;
import gov.aps.jca.CAException;
import gov.aps.jca.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


final class CaApplyRecord {

private static final Logger LOG = Logger.getLogger(CaApplyRecord.class
private static final Logger LOG = LoggerFactory.getLogger(CaApplyRecord.class
.getName());

private static final String DIR_SUFFIX = ".DIR";
Expand Down Expand Up @@ -51,7 +52,7 @@ synchronized void updateChannels() {
try {
dir = epicsWriter.getEnumChannel(epicsName + DIR_SUFFIX, CadDirective.class);
} catch (Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}
if (val == null) {
Expand All @@ -61,14 +62,14 @@ synchronized void updateChannels() {
val.registerListener(valListener);
}
} catch (Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}
if (mess == null) {
try {
mess = epicsReader.getStringChannel(epicsName + MSG_SUFFIX);
} catch (Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}
}
Expand All @@ -81,7 +82,7 @@ synchronized void unbind() {
try {
epicsWriter.destroyChannel(dir);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
dir = null;
}
Expand All @@ -90,7 +91,7 @@ synchronized void unbind() {
try {
epicsReader.destroyChannel(val);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
val = null;
}
Expand All @@ -99,7 +100,7 @@ synchronized void unbind() {
try {
epicsReader.destroyChannel(mess);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
mess = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import edu.gemini.epics.EpicsService;
import edu.gemini.epics.api.ChannelListener;
Expand All @@ -19,7 +20,7 @@

final class CaApplySenderImpl<C extends Enum<C> & CarStateGeneric> implements CaApplySender {

private static final Logger LOG = Logger.getLogger(CaApplySenderImpl.class
private static final Logger LOG = LoggerFactory.getLogger(CaApplySenderImpl.class
.getName());

private final String name;
Expand Down Expand Up @@ -118,17 +119,17 @@ void unbind() {
try {
apply.unregisterValListener(valListener);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
try {
car.unregisterClidListener(carClidListener);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
try {
car.unregisterValListener(carValListener);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

apply.unbind();
Expand Down Expand Up @@ -440,7 +441,7 @@ public void run() {
try {
msg = apply.getMessValue();
} catch (CAException | TimeoutException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
cm.completeFailure(new CaCommandError(msg));
}
Expand All @@ -458,7 +459,7 @@ public void run() {
try {
msg = car.getOmssValue();
} catch (CAException | TimeoutException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
cm.completeFailure(new CaCommandError(msg));
}
Expand All @@ -475,7 +476,7 @@ public void clear() throws TimeoutException {
try {
apply.setDir(CadDirective.CLEAR);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.ImmutableList;

Expand All @@ -18,7 +19,7 @@
import gov.aps.jca.CAException;

final class CaAttributeImpl<T> implements CaAttribute<T> {
private static final Logger LOG = Logger.getLogger(CaAttributeImpl.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(CaAttributeImpl.class.getName());

private EpicsReader epicsReader;
private ChannelListener<T> channelListener;
Expand Down Expand Up @@ -74,7 +75,7 @@ public void valueChanged(String arg0, List<T> arg1) {
};
this.epicsChannel.registerListener(channelListener);
} else {
LOG.warning("Unable to bind to channel " + channel);
LOG.warn("Unable to bind to channel " + channel);
}
}

Expand Down Expand Up @@ -174,7 +175,7 @@ static CaAttributeImpl<Double> createDoubleAttribute(
try {
attr.bind(epicsReader.getDoubleChannel(channel));
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

return attr;
Expand All @@ -188,7 +189,7 @@ static public CaAttributeImpl<Float> createFloatAttribute(
try {
attr.bind(epicsReader.getFloatChannel(channel));
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

return attr;
Expand All @@ -202,7 +203,7 @@ static public CaAttributeImpl<Integer> createIntegerAttribute(
try {
attr.bind(epicsReader.getIntegerChannel(channel));
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

return attr;
Expand All @@ -216,7 +217,7 @@ static public CaAttributeImpl<Short> createShortAttribute(
try {
attr.bind(epicsReader.getShortChannel(channel));
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

return attr;
Expand All @@ -230,7 +231,7 @@ static public CaAttributeImpl<String> createStringAttribute(
try {
attr.bind(epicsReader.getStringChannel(channel));
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

return attr;
Expand All @@ -244,7 +245,7 @@ static public <T extends Enum<T>> CaAttributeImpl<T> createEnumAttribute(
try {
attr.bind(epicsReader.getEnumChannel(channel, enumType));
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

return attr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
import gov.aps.jca.CAException;
import gov.aps.jca.TimeoutException;

import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

final class CaCarRecord<C extends Enum<C> & CarStateGeneric> {
private static final Logger LOG = Logger.getLogger(CaCarRecord.class
private static final Logger LOG = LoggerFactory.getLogger(CaCarRecord.class
.getName());

private static final String CAR_VAL_SUFFIX = ".VAL";
Expand Down Expand Up @@ -48,20 +49,20 @@ synchronized void updateChannels() {
clid.registerListener(clidListener);
}
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
try {
val = epicsReader.getEnumChannel(epicsName + CAR_VAL_SUFFIX, carClass);
if(valListener!=null) {
val.registerListener(valListener);
}
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
try {
omss = epicsReader.getStringChannel(epicsName + CAR_OMSS_SUFFIX);
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}

Expand All @@ -71,7 +72,7 @@ synchronized void unbind() {
epicsReader.destroyChannel(clid);
}
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
clid = null;

Expand All @@ -80,7 +81,7 @@ synchronized void unbind() {
epicsReader.destroyChannel(val);
}
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
val = null;

Expand All @@ -89,7 +90,7 @@ synchronized void unbind() {
epicsReader.destroyChannel(omss);
}
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
omss = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import edu.gemini.epics.EpicsService;
import edu.gemini.epics.EpicsWriter;
Expand All @@ -20,7 +21,7 @@

final class CaCommandSenderImpl implements CaCommandSender {

private static final Logger LOG = Logger.getLogger(CaCommandSenderImpl.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(CaCommandSenderImpl.class.getName());

private static final String DIR_SUFFIX = ".DIR";
private final String name;
Expand Down Expand Up @@ -50,7 +51,7 @@ public CaCommandSenderImpl(String name, CaApplySender apply,
try {
dirChannel = epicsWriter.getEnumChannel(cadName + DIR_SUFFIX, CadDirective.class);
} catch(Throwable e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}

Expand Down Expand Up @@ -107,7 +108,7 @@ public void unbind() {
dirChannel = null;
}
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

epicsWriter = null;
Expand Down Expand Up @@ -368,7 +369,7 @@ public void mark() throws TimeoutException {
try {
dirChannel.setValue(CadDirective.MARK);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}
}
Expand All @@ -379,7 +380,7 @@ public void clear() throws TimeoutException {
try {
dirChannel.setValue(CadDirective.CLEAR);
} catch (CAException e) {
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

package edu.gemini.epics.acm;

import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import gov.aps.jca.CAException;
import gov.aps.jca.TimeoutException;

public final class CaCommandSenderTest {
private static final Logger LOG = Logger.getLogger(CaCommandSenderTest.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(CaCommandSenderTest.class.getName());


public static void main(String[] args) throws CAException {
Expand Down Expand Up @@ -49,7 +50,7 @@ public void onPause() {
cm.waitDone();
} catch (CaException | CAException | TimeoutException | InterruptedException e) {
// TODO Auto-generated catch block
LOG.warning(e.getMessage());
LOG.warn(e.getMessage());
}

service.unbind();
Expand Down
Loading

0 comments on commit 9d6d665

Please sign in to comment.