Introducing the Modification classses
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / implementation / src / main / java / org / opendaylight / controller / sal / connector / remoterpc / CapturedMessageHandler.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.sal.connector.remoterpc;
10
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13 import org.zeromq.ZMQ;
14
15 public class CapturedMessageHandler implements Runnable {
16
17   private Logger _logger = LoggerFactory.getLogger(CapturedMessageHandler.class);
18
19   private ZMQ.Socket socket;
20
21   public CapturedMessageHandler(ZMQ.Socket socket){
22     this.socket = socket;
23   }
24
25   @Override
26   public void run(){
27
28     try {
29       while (!Thread.currentThread().isInterrupted()){
30         String message = socket.recvStr();
31         _logger.debug("Captured [{}]", message);
32       }
33     } catch (Exception e) {
34       _logger.error("Exception raised [{}]", e.getMessage());
35     }
36   }
37 }