java.lang.Object
com.oracle.libuv.Handle
com.oracle.libuv.IdleHandle
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class IdleHandle extends Handle
Idle handles will run the given callback once per loop
iteration, right before the
PrepareCallback handles.
See Idle handle
-
Field Summary
-
Method Summary
Modifier and Type Method Description voidclose()Close the handle and free up any resources that may be held by it.voidsetCloseCallback(CloseCallback callback)Attach aCloseCallback.voidsetIdleCallback(IdleCallback callback)Attach aIdleCallback.intstart()Starts the idle handle with the callback specifiedsetIdleCallback(IdleCallback).intstop()Stop the handle, the callback will no longer be called.
-
Method Details
-
setIdleCallback
Attach aIdleCallback.- Parameters:
callback- A Callback, which will be invoked once per loop iteration, right before thePrepareCallbackhandles.
-
setCloseCallback
Attach aCloseCallback.- Parameters:
callback- A Callback, which will be invoked when check handle is closed.- Throws:
java.lang.IllegalStateException- if this method called more than once.
-
start
public int start()Starts the idle handle with the callback specifiedsetIdleCallback(IdleCallback).- Returns:
0on success, or an errorcode < 0on failure.
-
stop
public int stop()Stop the handle, the callback will no longer be called.- Returns:
0on success, or an errorcode < 0on failure.
-
close
public void close()Close the handle and free up any resources that may be held by it.
-