2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.connector.remoterpc;
10 import org.zeromq.ZMQ;
12 import java.util.UUID;
17 public class SocketPair implements AutoCloseable{
18 private ZMQ.Socket sender;
19 private ZMQ.Socket receiver;
21 private static final String INPROC_PREFIX = "inproc://";
24 String address = new StringBuilder(INPROC_PREFIX)
25 .append(UUID.randomUUID())
28 receiver = Context.getInstance().getZmqContext().socket(ZMQ.PAIR);
29 receiver.bind(address);
31 sender = Context.getInstance().getZmqContext().socket(ZMQ.PAIR);
32 sender.connect(address);
35 public ZMQ.Socket getSender(){
39 public ZMQ.Socket getReceiver(){
44 public void close() throws Exception {