Improved logging in ScenarioHandler
[openflowjava.git] / simple-client / src / main / java / org / opendaylight / openflowjava / protocol / impl / clients / SleepEvent.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.clients;
3
4 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory;
6
7 /**
8  * Class representing sleep (wait) event
9  * 
10  * @author michal.polkorab
11  */
12 public class SleepEvent implements ClientEvent {
13
14     private static final Logger LOGGER = LoggerFactory.getLogger(SleepEvent.class);
15     private long sleepTime;
16
17     /**
18      * 
19      * @param sleepTime time of {@link Thread#sleep(long)} in milliseconds
20      */
21     public SleepEvent(long sleepTime) {
22         this.sleepTime = sleepTime;
23     }
24
25     @Override
26     public boolean eventExecuted() {
27         try {
28             Thread.sleep(sleepTime);
29             LOGGER.debug("Sleeping");
30             return true;
31         } catch (InterruptedException e) {
32             LOGGER.error(e.getMessage(), e);
33         }
34         return false;
35     }
36 }