Package com.xensource.xenapi
Class Event
java.lang.Object
com.xensource.xenapi.XenAPIObject
com.xensource.xenapi.Event
Asynchronous event registration and handling
First published in XenServer 4.0.
- Author:
- Cloud Software Group, Inc.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
If obj is a Event, compares XenAPI references for equality.static EventBatch
Blocking call which returns a new token and a (possibly empty) batch of events.static Long
Return the ID of the next event to be generated by the system Minimum allowed role: read-only First published in XenServer 4.0.int
hashCode()
static String
inject
(Connection c, String clazz, String ref) Injects an artificial event on the given object and returns the corresponding ID in the form of a token, which can be used as a point of reference for database events.static Set<Event.Record>
next
(Connection c) Deprecated.since XenServer 6.0static void
register
(Connection c, Set<String> classes) Deprecated.since XenServer 6.0static Task
registerAsync
(Connection c, Set<String> classes) Deprecated.since XenServer 6.0static void
unregister
(Connection c, Set<String> classes) Deprecated.since XenServer 6.0static Task
unregisterAsync
(Connection c, Set<String> classes) Deprecated.since XenServer 6.0Methods inherited from class com.xensource.xenapi.XenAPIObject
isNull
-
Field Details
-
ref
The XenAPI reference (OpaqueRef) to this object.
-
-
Method Details
-
toWireString
- Specified by:
toWireString
in classXenAPIObject
- Returns:
- The XenAPI reference (OpaqueRef) to this object.
-
equals
If obj is a Event, compares XenAPI references for equality. -
hashCode
public int hashCode() -
register
@Deprecated(since="XenServer 6.0") public static void register(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, IOException Deprecated.since XenServer 6.0Registers this session with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onclasses
- the classes for which the session will register with the event system; specifying * as the desired class will register for all classes- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
registerAsync
@Deprecated(since="XenServer 6.0") public static Task registerAsync(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, IOException Deprecated.since XenServer 6.0Registers this session with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onclasses
- the classes for which the session will register with the event system; specifying * as the desired class will register for all classes- Returns:
- Task
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
unregister
@Deprecated(since="XenServer 6.0") public static void unregister(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, IOException Deprecated.since XenServer 6.0Removes this session's registration with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onclasses
- the classes for which the session's registration with the event system will be removed- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
unregisterAsync
@Deprecated(since="XenServer 6.0") public static Task unregisterAsync(Connection c, Set<String> classes) throws Types.BadServerResponse, Types.XenAPIException, IOException Deprecated.since XenServer 6.0Removes this session's registration with the event system for a set of given classes. This method is only recommended for legacy use in conjunction with event.next. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onclasses
- the classes for which the session's registration with the event system will be removed- Returns:
- Task
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
next
@Deprecated(since="XenServer 6.0") public static Set<Event.Record> next(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException, Types.SessionNotRegistered, Types.EventsLost Deprecated.since XenServer 6.0Blocking call which returns a (possibly empty) batch of events. This method is only recommended for legacy use. New development should use event.from which supersedes this method. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- A set of events
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.Types.SessionNotRegistered
- This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed.Types.EventsLost
- Some events have been lost from the queue and cannot be retrieved.
-
from
public static EventBatch from(Connection c, Set<String> classes, String token, Double timeout) throws Types.BadServerResponse, Types.XenAPIException, IOException, Types.SessionNotRegistered, Types.EventsLost Blocking call which returns a new token and a (possibly empty) batch of events. The returned token can be used in subsequent calls to this function. Minimum allowed role: read-only First published in XenServer 6.0.- Parameters:
c
- The connection the call is made onclasses
- register for events for the indicated classestoken
- A token representing the point from which to generate database events. The empty string represents the beginning.timeout
- Return after this many seconds if no events match- Returns:
- a structure consisting of a token ('token'), a map of valid references per object type ('valid_ref_counts'), and a set of event records ('events').
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.Types.SessionNotRegistered
- This session is not registered to receive events. You must call event.register before event.next. The session handle you are using is echoed.Types.EventsLost
- Some events have been lost from the queue and cannot be retrieved.
-
getCurrentId
public static Long getCurrentId(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Return the ID of the next event to be generated by the system Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- the event ID
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
inject
public static String inject(Connection c, String clazz, String ref) throws Types.BadServerResponse, Types.XenAPIException, IOException Injects an artificial event on the given object and returns the corresponding ID in the form of a token, which can be used as a point of reference for database events. For example, to check whether an object has reached the right state before attempting an operation, one can inject an artificial event on the object and wait until the token returned by consecutive event.from calls is lexicographically greater than the one returned by event.inject. Minimum allowed role: read-only First published in XenServer 6.1.- Parameters:
c
- The connection the call is made onclazz
- class of the objectref
- A reference to the object that will be changed.- Returns:
- the event ID in the form of a token
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-