1 /* 2 ################################################################################ 3 # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # 4 # Read the zproject/README.md for information about making permanent changes. # 5 ################################################################################ 6 */ 7 package org.zeromq.czmq; 8 9 public class Ztimerset implements AutoCloseable{ 10 static { 11 try { 12 System.loadLibrary ("czmqjni"); 13 } 14 catch (Exception e) { 15 System.exit (-1); 16 } 17 } 18 public long self; 19 /* 20 Create new timer set. 21 */ __new()22 native static long __new (); Ztimerset()23 public Ztimerset () { 24 /* TODO: if __new fails, self is null... */ 25 self = __new (); 26 } Ztimerset(long pointer)27 public Ztimerset (long pointer) { 28 self = pointer; 29 } 30 /* 31 Destroy a timer set 32 */ __destroy(long self)33 native static void __destroy (long self); 34 @Override close()35 public void close () { 36 __destroy (self); 37 self = 0; 38 } 39 /* 40 Cancel a timer. Returns 0 if OK, -1 on failure. 41 */ __cancel(long self, int timerId)42 native static int __cancel (long self, int timerId); cancel(int timerId)43 public int cancel (int timerId) { 44 return __cancel (self, timerId); 45 } 46 /* 47 Set timer interval. Returns 0 if OK, -1 on failure. 48 This method is slow, canceling the timer and adding a new one yield better performance. 49 */ __setInterval(long self, int timerId, long interval)50 native static int __setInterval (long self, int timerId, long interval); setInterval(int timerId, long interval)51 public int setInterval (int timerId, long interval) { 52 return __setInterval (self, timerId, interval); 53 } 54 /* 55 Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. 56 This method is slow, canceling the timer and adding a new one yield better performance. 57 */ __reset(long self, int timerId)58 native static int __reset (long self, int timerId); reset(int timerId)59 public int reset (int timerId) { 60 return __reset (self, timerId); 61 } 62 /* 63 Return the time until the next interval. 64 Should be used as timeout parameter for the zpoller wait method. 65 The timeout is in msec. 66 */ __timeout(long self)67 native static int __timeout (long self); timeout()68 public int timeout () { 69 return __timeout (self); 70 } 71 /* 72 Invoke callback function of all timers which their interval has elapsed. 73 Should be call after zpoller wait method. 74 Returns 0 if OK, -1 on failure. 75 */ __execute(long self)76 native static int __execute (long self); execute()77 public int execute () { 78 return __execute (self); 79 } 80 /* 81 Self test of this class. 82 */ __test(boolean verbose)83 native static void __test (boolean verbose); test(boolean verbose)84 public static void test (boolean verbose) { 85 __test (verbose); 86 } 87 } 88