Пример:
@Resource (name = "eis/ParPort")
private ConnectionFactory connFactory;
Connection conn = null;
try {
conn = connFactory.getConnection();
Interaction interaction = conn.createInteraction ();
MappedRecord r =
connFactory.getRecordFactory ().createMappedRecord ("");
r.put ("eye1", true); // turn eye1 pin into the on state
r.put ("eye2", false); // turn eye2 off
interaction.execute (null, r);
} catch (ResourceException e) {
e.printStackTrace (); // Not sexy
} finally {
if (conn != null) {
try {
conn.close();
} catch (ResourceException e) {
e.printStackTrace (); // Not sexy
}
}
}
Комментариев нет:
Отправить комментарий