import java.net.URI;
import java.util.concurrent.CountDownLatch;
-import javax.websocket.ClientEndpoint;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.onap.policy.api.NotificationScheme;
import org.onap.policy.std.StdPDPNotification;
import org.onap.policy.xacml.api.XACMLErrorConstants;
-@ClientEndpoint
public class ManualClientEnd extends WebSocketClient {
private static CountDownLatch latch;
private static StdPDPNotification notification = null;
logger.info("Manual Notification Recieved Message from : " + getURI() + ", Notification: " + message);
ManualClientEnd.resultJson = message;
try {
- ManualClientEnd.notification = NotificationUnMarshal.notificationJSON(message);
- latch.countDown();
+ ManualClientEnd.notification = NotificationUnMarshal.notificationJSON(message);
} catch (Exception e) {
logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
- latch.countDown();
}
+ latch.countDown();
}
@Override
client = new ManualClientEnd(new URI(url + "notifications"));
client.connect();
latch.await();
- client.close();
+ client.closeBlocking();
} catch (Exception e) {
logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
}