@Override
public void connect() {
try {
final Field field = WSHumanTaskHandler.class.getDeclaredField("client");
TaskClient client = (TaskClient) field.get(this);
if (client == null) {
client = new TaskClient(new JMSTaskClientConnector(
"org.drools.process.workitem.wsht.WSThroughJMSHumanTaskHandler",
new JMSTaskClientHandler(SystemEventListenerFactory
.getSystemEventListener()),
WSHumanTaskJMSProperties.getInstance().getProperties(),
new InitialContext(WSHumanTaskJMSProperties.getInstance().getProperties())));
field.set(this, client);
boolean connected = client.connect();
if (!connected) {
throw new IllegalArgumentException("Could not connect to the task client");
}
}
super.connect();