OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / samples / simple-client / src / main / java / org / opendaylight / openflowjava / protocol / impl / clients / SleepEvent.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. 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.openflowjava.protocol.impl.clients;
10
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13
14 /**
15  * Class representing sleep (wait) event.
16  *
17  * @author michal.polkorab
18  */
19 public class SleepEvent implements ClientEvent {
20
21     private static final Logger LOG = LoggerFactory.getLogger(SleepEvent.class);
22     private final long sleepTime;
23
24     /**
25      * Constructor.
26      *
27      * @param sleepTime time of {@link Thread#sleep(long)} in milliseconds
28      */
29     public SleepEvent(long sleepTime) {
30         this.sleepTime = sleepTime;
31     }
32
33     @Override
34     public boolean eventExecuted() {
35         try {
36             Thread.sleep(sleepTime);
37             LOG.debug("Sleeping");
38             return true;
39         } catch (InterruptedException e) {
40             LOG.error("Error {}", e);
41         }
42         return false;
43     }
44 }