http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteAuthorizationEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteAuthorizationEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteAuthorizationEvent.java deleted file mode 100644 index fb2d5e2..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteAuthorizationEvent.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.plugin.security.*; - -/** - * Grid authorization event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * @see IgniteEventType#EVT_AUTHORIZATION_FAILED - * @see IgniteEventType#EVT_AUTHORIZATION_SUCCEEDED - */ -public class IgniteAuthorizationEvent extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** Requested operation. */ - private GridSecurityPermission op; - - /** Authenticated subject authorized to perform operation. */ - private GridSecuritySubject subj; - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return name() + ": op=" + op; - } - - /** - * No-arg constructor. - */ - public IgniteAuthorizationEvent() { - // No-op. - } - - /** - * Creates authorization event with given parameters. - * - * @param msg Optional message. - * @param type Event type. - */ - public IgniteAuthorizationEvent(ClusterNode node, String msg, int type) { - super(node, msg, type); - } - - /** - * Creates authorization event with given parameters. - * - * @param node Node. - * @param msg Optional message. - * @param type Event type. - * @param op Requested operation. - * @param subj Authenticated subject. - */ - public IgniteAuthorizationEvent(ClusterNode node, String msg, int type, GridSecurityPermission op, - GridSecuritySubject subj) { - super(node, msg, type); - - this.op = op; - this.subj = subj; - } - - /** - * Gets requested operation. - * - * @return Requested operation. - */ - public GridSecurityPermission operation() { - return op; - } - - /** - * Sets requested operation. - * - * @param op Requested operation. - */ - public void operation(GridSecurityPermission op) { - this.op = op; - } - - /** - * Gets authenticated subject. - * - * @return Authenticated subject. - */ - public GridSecuritySubject subject() { - return subj; - } - - /** - * Sets authenticated subject. - * - * @param subj Authenticated subject. - */ - public void subject(GridSecuritySubject subj) { - this.subj = subj; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteAuthorizationEvent.class, this, - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheEvent.java deleted file mode 100644 index 9c944c9..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheEvent.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * In-memory database (cache) event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * @see IgniteEventType#EVT_CACHE_ENTRY_CREATED - * @see IgniteEventType#EVT_CACHE_ENTRY_DESTROYED - * @see IgniteEventType#EVT_CACHE_ENTRY_EVICTED - * @see IgniteEventType#EVT_CACHE_OBJECT_PUT - * @see IgniteEventType#EVT_CACHE_OBJECT_READ - * @see IgniteEventType#EVT_CACHE_OBJECT_REMOVED - * @see IgniteEventType#EVT_CACHE_OBJECT_LOCKED - * @see IgniteEventType#EVT_CACHE_OBJECT_UNLOCKED - * @see IgniteEventType#EVT_CACHE_OBJECT_SWAPPED - * @see IgniteEventType#EVT_CACHE_OBJECT_UNSWAPPED - * @see IgniteEventType#EVT_CACHE_OBJECT_EXPIRED - */ -public class IgniteCacheEvent extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** Partition for the event. */ - private int part; - - /** Cache entry. */ - @GridToStringInclude - private Object key; - - /** Event ID. */ - @GridToStringInclude - private final IgniteUuid xid; - - /** Lock ID. */ - @GridToStringInclude - private final Object lockId; - - /** New value. */ - @GridToStringInclude - private final Object newVal; - - /** Old value. */ - @GridToStringInclude - private final Object oldVal; - - /** - * Flag indicating whether old value is present in case if we - * don't have it in deserialized form. - */ - @GridToStringInclude - private final boolean hasOldVal; - - /** - * Flag indicating whether new value is present in case if we - * don't have it in deserialized form. - */ - @GridToStringInclude - private final boolean hasNewVal; - - /** Event node. */ - @GridToStringExclude - @Nullable private final ClusterNode evtNode; - - /** Flag indicating whether event happened on {@code near} or {@code partitioned} cache. */ - @GridToStringInclude - private boolean near; - - /** Subject ID. */ - @GridToStringInclude - private UUID subjId; - - /** Closure class name. */ - @GridToStringInclude - private String cloClsName; - - /** Task name if update was initiated within task execution. */ - @GridToStringInclude - private String taskName; - - /** - * Constructs cache event. - * - * @param cacheName Cache name. - * @param node Local node. - * @param evtNode Event node ID. - * @param msg Event message. - * @param type Event type. - * @param part Partition for the event (usually the partition the key belongs to). - * @param near Flag indicating whether event happened on {@code near} or {@code partitioned} cache. - * @param key Cache key. - * @param xid Transaction ID. - * @param lockId Lock ID. - * @param newVal New value. - * @param hasNewVal Flag indicating whether new value is present in case if we - * don't have it in deserialized form. - * @param oldVal Old value. - * @param hasOldVal Flag indicating whether old value is present in case if we - * don't have it in deserialized form. - * @param subjId Subject ID. - * @param cloClsName Closure class name. - */ - public IgniteCacheEvent(String cacheName, ClusterNode node, @Nullable ClusterNode evtNode, String msg, int type, int part, - boolean near, Object key, IgniteUuid xid, Object lockId, Object newVal, boolean hasNewVal, - Object oldVal, boolean hasOldVal, UUID subjId, String cloClsName, String taskName) { - super(node, msg, type); - this.cacheName = cacheName; - this.evtNode = evtNode; - this.part = part; - this.near = near; - this.key = key; - this.xid = xid; - this.lockId = lockId; - this.newVal = newVal; - this.hasNewVal = hasNewVal; - this.oldVal = oldVal; - this.hasOldVal = hasOldVal; - this.subjId = subjId; - this.cloClsName = cloClsName; - this.taskName = taskName; - } - - /** - * Gets cache name. - * - * @return Cache name. - */ - @Nullable public String cacheName() { - return cacheName; - } - - /** - * Gets partition for the event which is the partition the key belongs to. - * - * @return Partition for the event. - */ - public int partition() { - return part; - } - - /** - * Gets flag indicating whether event happened on {@code near} or {@code partitioned} cache. - * - * @return Flag indicating whether event happened on {@code near} or {@code partitioned} cache. - */ - public boolean isNear() { - return near; - } - - /** - * Gets node which initiated cache operation or {@code null} if that node is not available. - * - * @return Node which initiated cache operation or {@code null} if that node is not available. - */ - @Nullable public ClusterNode eventNode() { - return evtNode; - } - - /** - * Gets cache entry associated with event. - * - * @return Cache entry associated with event. - */ - @SuppressWarnings({"unchecked"}) - @Nullable public <K> K key() { - return (K)key; - } - - /** - * ID of surrounding cache cache transaction or <tt>null</tt> if there is - * no surrounding transaction. - * - * @return ID of surrounding cache transaction. - */ - @Nullable public IgniteUuid xid() { - return xid; - } - - /** - * ID of the lock if held or <tt>null</tt> if no lock held. - * - * @return ID of the lock if held. - */ - @Nullable public Object lockId() { - return lockId; - } - - /** - * Gets new value for this event. - * - * @return New value associated with event (<tt>null</tt> if event is - * {@link IgniteEventType#EVT_CACHE_OBJECT_REMOVED}. - */ - @Nullable public Object newValue() { - return newVal; - } - - /** - * Gets old value associated with this event. - * - * @return Old value associated with event. - */ - @Nullable public Object oldValue() { - return oldVal; - } - - /** - * Gets flag indicating whether cache entry has old value in case if - * we only have old value in serialized form in which case {@link #oldValue()} - * will return {@code null}. - * - * @return Flag indicating whether there is old value associated with this event. - */ - public boolean hasOldValue() { - return hasOldVal; - } - - /** - * Gets flag indicating whether cache entry has new value in case if - * we only have new value in serialized form in which case {@link #newValue()} - * will return {@code null}. - * - * @return Flag indicating whether there is new value associated with this event. - */ - public boolean hasNewValue() { - return hasNewVal; - } - - /** - * Gets security subject ID initiated this cache event, if available. This property is available only for - * {@link IgniteEventType#EVT_CACHE_OBJECT_PUT}, {@link IgniteEventType#EVT_CACHE_OBJECT_REMOVED} and - * {@link IgniteEventType#EVT_CACHE_OBJECT_READ} cache events. - * <p> - * Subject ID will be set either to nodeId initiated cache update or read or client ID initiated - * cache update or read. - * - * @return Subject ID. - */ - @Nullable public UUID subjectId() { - return subjId; - } - - /** - * Gets closure class name (applicable only for TRANSFORM operations). - * - * @return Closure class name. - */ - @Nullable public String closureClassName() { - return cloClsName; - } - - /** - * Gets task name if cache event was caused by an operation initiated within task execution. - * - * @return Task name. - */ - @Nullable public String taskName() { - return taskName; - } - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return name() + ": near=" + near + ", key=" + key + ", hasNewVal=" + hasNewVal + ", hasOldVal=" + hasOldVal + - ", nodeId8=" + U.id8(node().id()); - } - - /** {@inheritDoc} */ - @SuppressWarnings("ConstantConditions") - @Override public String toString() { - return S.toString(IgniteCacheEvent.class, this, - "nodeId8", U.id8(node().id()), - "evtNodeId8", U.id8(evtNode.id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteCachePreloadingEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteCachePreloadingEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteCachePreloadingEvent.java deleted file mode 100644 index 5a699cf..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteCachePreloadingEvent.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -/** - * In-memory database (cache) preloading event. Preload event happens every time there is a change - * in grid topology, which means that a node has either joined or left the grid. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * @see IgniteEventType#EVT_CACHE_PRELOAD_PART_LOADED - * @see IgniteEventType#EVT_CACHE_PRELOAD_PART_UNLOADED - * @see IgniteEventType#EVT_CACHE_PRELOAD_STARTED - * @see IgniteEventType#EVT_CACHE_PRELOAD_STOPPED - */ -public class IgniteCachePreloadingEvent extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** Cache name. */ - private String cacheName; - - /** Partition for the event. */ - private int part; - - /** Discovery node. */ - private ClusterNode discoNode; - - /** Discovery event type. */ - private int discoEvtType; - - /** Discovery event time. */ - private long discoTs; - - /** - * Constructs cache event. - * - * @param cacheName Cache name. - * @param node Event node. - * @param msg Event message. - * @param type Event type. - * @param part Partition for the event (usually the partition the key belongs to). - * @param discoNode Node that triggered this preloading event. - * @param discoEvtType Discovery event type that triggered this preloading event. - * @param discoTs Timestamp of discovery event that triggered this preloading event. - */ - public IgniteCachePreloadingEvent(String cacheName, ClusterNode node, String msg, int type, int part, - ClusterNode discoNode, int discoEvtType, long discoTs) { - super(node, msg, type); - this.cacheName = cacheName; - this.part = part; - this.discoNode = discoNode; - this.discoEvtType = discoEvtType; - this.discoTs = discoTs; - } - - /** - * Gets cache name. - * - * @return Cache name. - */ - public String cacheName() { - return cacheName; - } - - /** - * Gets partition for the event. - * - * @return Partition for the event. - */ - public int partition() { - return part; - } - - /** - * Gets shadow of the node that triggered this preloading event. - * - * @return Shadow of the node that triggered this preloading event. - */ - public ClusterNode discoveryNode() { - return discoNode; - } - - /** - * Gets type of discovery event that triggered this preloading event. - * - * @return Type of discovery event that triggered this preloading event. - * @see IgniteDiscoveryEvent#type() - */ - public int discoveryEventType() { - return discoEvtType; - } - - /** - * Gets name of discovery event that triggered this preloading event. - * - * @return Name of discovery event that triggered this preloading event. - * @see IgniteDiscoveryEvent#name() - */ - public String discoveryEventName() { - return U.gridEventName(discoEvtType); - } - - /** - * Gets timestamp of discovery event that caused this preloading event. - * - * @return Timestamp of discovery event that caused this preloading event. - */ - public long discoveryTimestamp() { - return discoTs; - } - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return name() + ": cache=" + CU.mask(cacheName) + ", cause=" + - discoveryEventName(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCachePreloadingEvent.class, this, - "discoEvtName", discoveryEventName(), - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryExecutedEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryExecutedEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryExecutedEvent.java deleted file mode 100644 index 18631d3..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryExecutedEvent.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cache.query.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Cache query execution event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * - * @see IgniteEventType#EVT_CACHE_QUERY_EXECUTED - * @see IgniteEventType#EVTS_CACHE_QUERY - */ -public class IgniteCacheQueryExecutedEvent<K, V> extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = 3738753361235304496L; - - /** Query type. */ - private final CacheQueryType qryType; - - /** Cache name. */ - private final String cacheName; - - /** Class name. */ - private final String clsName; - - /** Clause. */ - private final String clause; - - /** Scan query filter. */ - @GridToStringInclude - private final IgniteBiPredicate<K, V> scanQryFilter; - - /** Continuous query filter. */ - @GridToStringInclude - private final IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter; - - /** Query arguments. */ - @GridToStringInclude - private final Object[] args; - - /** Security subject ID. */ - private final UUID subjId; - - /** Task name. */ - private final String taskName; - - /** - * @param node Node where event was fired. - * @param msg Event message. - * @param type Event type. - * @param qryType Query type. - * @param cacheName Cache name. - * @param clsName Class name. - * @param clause Clause. - * @param scanQryFilter Scan query filter. - * @param args Query arguments. - * @param subjId Security subject ID. - */ - public IgniteCacheQueryExecutedEvent( - ClusterNode node, - String msg, - int type, - CacheQueryType qryType, - @Nullable String cacheName, - @Nullable String clsName, - @Nullable String clause, - @Nullable IgniteBiPredicate<K, V> scanQryFilter, - @Nullable IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter, - @Nullable Object[] args, - @Nullable UUID subjId, - @Nullable String taskName) { - super(node, msg, type); - - assert qryType != null; - - this.qryType = qryType; - this.cacheName = cacheName; - this.clsName = clsName; - this.clause = clause; - this.scanQryFilter = scanQryFilter; - this.contQryFilter = contQryFilter; - this.args = args; - this.subjId = subjId; - this.taskName = taskName; - } - - /** - * Gets query type. - * - * @return Query type. - */ - public CacheQueryType queryType() { - return qryType; - } - - /** - * Gets cache name on which query was executed. - * - * @return Cache name. - */ - @Nullable public String cacheName() { - return cacheName; - } - - /** - * Gets queried class name. - * <p> - * Applicable for {@code SQL} and @{code full text} queries. - * - * @return Queried class name. - */ - @Nullable public String className() { - return clsName; - } - - /** - * Gets query clause. - * <p> - * Applicable for {@code SQL}, {@code SQL fields} and @{code full text} queries. - * - * @return Query clause. - */ - @Nullable public String clause() { - return clause; - } - - /** - * Gets scan query filter. - * <p> - * Applicable for {@code scan} queries. - * - * @return Scan query filter. - */ - @Nullable public IgniteBiPredicate<K, V> scanQueryFilter() { - return scanQryFilter; - } - - /** - * Gets continuous query filter. - * <p> - * Applicable for {@code continuous} queries. - * - * @return Continuous query filter. - */ - @Nullable public IgnitePredicate<CacheContinuousQueryEntry<K, V>> continuousQueryFilter() { - return contQryFilter; - } - - /** - * Gets query arguments. - * <p> - * Applicable for {@code SQL} and {@code SQL fields} queries. - * - * @return Query arguments. - */ - @Nullable public Object[] arguments() { - return args; - } - - /** - * Gets security subject ID. - * - * @return Security subject ID. - */ - @Nullable public UUID subjectId() { - return subjId; - } - - /** - * Gets the name of the task that executed the query (if any). - * - * @return Task name. - */ - @Nullable public String taskName() { - return taskName; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCacheQueryExecutedEvent.class, this, - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java deleted file mode 100644 index 9d0dcf6..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteCacheQueryReadEvent.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cache.query.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * Cache query read event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * - * @see IgniteEventType#EVT_CACHE_QUERY_OBJECT_READ - * @see IgniteEventType#EVTS_CACHE_QUERY - */ -public class IgniteCacheQueryReadEvent<K, V> extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = -1984731272984397445L; - - /** Query type. */ - private final CacheQueryType qryType; - - /** Cache name. */ - private final String cacheName; - - /** Class name. */ - private final String clsName; - - /** Clause. */ - private final String clause; - - /** Scan query filter. */ - @GridToStringInclude - private final IgniteBiPredicate<K, V> scanQryFilter; - - /** Continuous query filter. */ - @GridToStringInclude - private final IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter; - - /** Query arguments. */ - @GridToStringInclude - private final Object[] args; - - /** Security subject ID. */ - private final UUID subjId; - - /** Task name. */ - private final String taskName; - - /** Key. */ - @GridToStringInclude - private final K key; - - /** Value. */ - @GridToStringInclude - private final V val; - - /** Old value. */ - @GridToStringInclude - private final V oldVal; - - /** Result row. */ - @GridToStringInclude - private final Object row; - - /** - * @param node Node where event was fired. - * @param msg Event message. - * @param type Event type. - * @param cacheName Cache name. - * @param clsName Class name. - * @param clause Clause. - * @param scanQryFilter Scan query filter. - * @param args Query arguments. - * @param subjId Security subject ID. - * @param key Key. - * @param val Value. - * @param oldVal Old value. - */ - public IgniteCacheQueryReadEvent( - ClusterNode node, - String msg, - int type, - CacheQueryType qryType, - @Nullable String cacheName, - @Nullable String clsName, - @Nullable String clause, - @Nullable IgniteBiPredicate<K, V> scanQryFilter, - @Nullable IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter, - @Nullable Object[] args, - @Nullable UUID subjId, - @Nullable String taskName, - @Nullable K key, - @Nullable V val, - @Nullable V oldVal, - @Nullable Object row) { - super(node, msg, type); - - assert qryType != null; - - this.qryType = qryType; - this.cacheName = cacheName; - this.clsName = clsName; - this.clause = clause; - this.scanQryFilter = scanQryFilter; - this.contQryFilter = contQryFilter; - this.args = args; - this.subjId = subjId; - this.taskName = taskName; - this.key = key; - this.val = val; - this.oldVal = oldVal; - this.row = row; - } - - /** - * Gets query type. - * - * @return Query type. - */ - public CacheQueryType queryType() { - return qryType; - } - - /** - * Gets cache name on which query was executed. - * - * @return Cache name. - */ - @Nullable public String cacheName() { - return cacheName; - } - - /** - * Gets queried class name. - * <p> - * Applicable for {@code SQL} and @{code full text} queries. - * - * @return Queried class name. - */ - @Nullable public String className() { - return clsName; - } - - /** - * Gets query clause. - * <p> - * Applicable for {@code SQL}, {@code SQL fields} and @{code full text} queries. - * - * @return Query clause. - */ - @Nullable public String clause() { - return clause; - } - - /** - * Gets scan query filter. - * <p> - * Applicable for {@code scan} queries. - * - * @return Scan query filter. - */ - @Nullable public IgniteBiPredicate<K, V> scanQueryFilter() { - return scanQryFilter; - } - - /** - * Gets continuous query filter. - * <p> - * Applicable for {@code continuous} queries. - * - * @return Continuous query filter. - */ - @Nullable public IgnitePredicate<CacheContinuousQueryEntry<K, V>> continuousQueryFilter() { - return contQryFilter; - } - - /** - * Gets query arguments. - * <p> - * Applicable for {@code SQL} and {@code SQL fields} queries. - * - * @return Query arguments. - */ - @Nullable public Object[] arguments() { - return args; - } - - /** - * Gets security subject ID. - * - * @return Security subject ID. - */ - @Nullable public UUID subjectId() { - return subjId; - } - - /** - * Gets the name of the task that executed the query (if any). - * - * @return Task name. - */ - @Nullable public String taskName() { - return taskName; - } - - /** - * Gets read entry key. - * - * @return Key. - */ - @Nullable public K key() { - return key; - } - - /** - * Gets read entry value. - * - * @return Value. - */ - @Nullable public V value() { - return val; - } - - /** - * Gets read entry old value (applicable for continuous queries). - * - * @return Old value. - */ - @Nullable public V oldValue() { - return oldVal; - } - - /** - * Gets read results set row. - * - * @return Result row. - */ - @Nullable public Object row() { - return row; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCacheQueryReadEvent.class, this, - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteCheckpointEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteCheckpointEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteCheckpointEvent.java deleted file mode 100644 index 1f25555..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteCheckpointEvent.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -/** - * Grid checkpoint event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * @see IgniteEventType#EVT_CHECKPOINT_LOADED - * @see IgniteEventType#EVT_CHECKPOINT_REMOVED - * @see IgniteEventType#EVT_CHECKPOINT_SAVED - * @see IgniteEventType#EVTS_CHECKPOINT - */ -public class IgniteCheckpointEvent extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private String cpKey; - - /** - * No-arg constructor. - */ - public IgniteCheckpointEvent() { - // No-op. - } - - /** - * Creates new checkpoint event with given parameters. - * - * @param node Local node. - * @param msg Optional event message. - * @param type Event type. - * @param cpKey Checkpoint key associated with this event. - */ - public IgniteCheckpointEvent(ClusterNode node, String msg, int type, String cpKey) { - super(node, msg, type); - - this.cpKey = cpKey; - } - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return name() + ": cpKey=" + cpKey; - } - - /** - * Gets checkpoint key associated with this event. - * - * @return Checkpoint key associated with this event. - */ - public String key() { - assert cpKey != null; - - return cpKey; - } - - /** - * Sets checkpoint key. - * - * @param cpKey Checkpoint key to set. - */ - public void key(String cpKey) { - assert cpKey != null; - - this.cpKey = cpKey; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteCheckpointEvent.class, this, - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteDeploymentEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteDeploymentEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteDeploymentEvent.java deleted file mode 100644 index 2e62647..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteDeploymentEvent.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -/** - * Grid deployment event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * @see IgniteEventType#EVT_CLASS_DEPLOY_FAILED - * @see IgniteEventType#EVT_CLASS_DEPLOYED - * @see IgniteEventType#EVT_CLASS_UNDEPLOYED - * @see IgniteEventType#EVT_TASK_DEPLOY_FAILED - * @see IgniteEventType#EVT_TASK_DEPLOYED - * @see IgniteEventType#EVT_TASK_UNDEPLOYED - * @see IgniteEventType#EVTS_DEPLOYMENT - */ -public class IgniteDeploymentEvent extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private String alias; - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return name() + (alias != null ? ": " + alias : ""); - } - - /** - * No-arg constructor. - */ - public IgniteDeploymentEvent() { - // No-op. - } - - /** - * Creates deployment event with given parameters. - * - * @param node Node. - * @param msg Optional event message. - * @param type Event type. - */ - public IgniteDeploymentEvent(ClusterNode node, String msg, int type) { - super(node, msg, type); - } - - /** - * Gets deployment alias for this event. - * - * @return Deployment alias. - */ - public String alias() { - return alias; - } - - /** - * Sets deployment alias for this event. - * - * @param alias Deployment alias. - */ - public void alias(String alias) { - this.alias = alias; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteDeploymentEvent.class, this, - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteDiscoveryEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteDiscoveryEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteDiscoveryEvent.java deleted file mode 100644 index 87249bd..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteDiscoveryEvent.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.util.*; - -/** - * Grid discovery event. - * <p> - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - - * asynchronously querying events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - - * querying only local events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - - * listening to local grid events (events from remote nodes not included). - * </li> - * </ul> - * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * @see IgniteEventType#EVT_NODE_METRICS_UPDATED - * @see IgniteEventType#EVT_NODE_FAILED - * @see IgniteEventType#EVT_NODE_JOINED - * @see IgniteEventType#EVT_NODE_LEFT - * @see IgniteEventType#EVT_NODE_SEGMENTED - * @see IgniteEventType#EVTS_DISCOVERY_ALL - * @see IgniteEventType#EVTS_DISCOVERY - */ -public class IgniteDiscoveryEvent extends IgniteEventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private ClusterNode evtNode; - - /** Topology version. */ - private long topVer; - - /** Collection of nodes corresponding to topology version. */ - private Collection<ClusterNode> topSnapshot; - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return name() + ": id8=" + U.id8(evtNode.id()) + ", ip=" + F.first(evtNode.addresses()); - } - - /** - * No-arg constructor. - */ - public IgniteDiscoveryEvent() { - // No-op. - } - - /** - * Creates new discovery event with given parameters. - * - * @param node Local node. - * @param msg Optional event message. - * @param type Event type. - * @param evtNode Node that caused this event to be generated. - */ - public IgniteDiscoveryEvent(ClusterNode node, String msg, int type, ClusterNode evtNode) { - super(node, msg, type); - - this.evtNode = evtNode; - } - - /** - * Sets node this event is referring to. - * - * @param evtNode Event node. - */ - public void eventNode(ClusterNode evtNode) { - this.evtNode = evtNode; - } - - /** - * Gets node that caused this event to be generated. It is potentially different from the node - * on which this event was recorded. For example, node {@code A} locally recorded the event that a remote node - * {@code B} joined the topology. In this case this method will return ID of {@code B}. - * - * @return Event node ID. - */ - public ClusterNode eventNode() { - return evtNode; - } - - /** - * Gets topology version if this event is raised on - * topology change and configured discovery SPI implementation - * supports topology versioning. - * - * @return Topology version or {@code 0} if configured discovery SPI implementation - * does not support versioning. - */ - public long topologyVersion() { - return topVer; - } - - /** - * Gets topology nodes from topology snapshot. If SPI implementation does not support - * versioning, the best effort snapshot will be captured. - * - * @return Topology snapshot. - */ - public Collection<ClusterNode> topologyNodes() { - return topSnapshot; - } - - /** - * Sets the topology snapshot. - * - * @param topVer Topology version. - * @param topSnapshot Topology snapshot. - */ - public void topologySnapshot(long topVer, Collection<ClusterNode> topSnapshot) { - this.topVer = topVer; - this.topSnapshot = topSnapshot; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteDiscoveryEvent.class, this, - "nodeId8", U.id8(node().id()), - "msg", message(), - "type", name(), - "tstamp", timestamp()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteEvent.java deleted file mode 100644 index 2eaf479..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteEvent.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -import java.io.*; - -/** - * Grid events are used for notification about what happens within the grid. Note that by - * design GridGain keeps all events generated on the local node locally and it provides - * APIs for performing a distributed queries across multiple nodes: - * <ul> - * <li> - * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - querying - * events occurred on the nodes specified, including remote nodes. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - querying only local - * events stored on this local node. - * </li> - * <li> - * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - listening - * to local grid events (events from remote nodes not included). - * </li> - * </ul> - * <h1 class="header">Events and Performance</h1> - * Note that by default all events in GridGain are enabled and therefore generated and stored - * by whatever event storage SPI is configured. GridGain can and often does generate thousands events per seconds - * under the load and therefore it creates a significant additional load on the system. If these events are - * not needed by the application this load is unnecessary and leads to significant performance degradation. - * <p> - * It is <b>highly recommended</b> to enable only those events that your application logic requires - * by using either {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in GridGain configuration. Note that certain - * events are required for GridGain's internal operations and such events will still be generated but not stored by - * event storage SPI if they are disabled in GridGain configuration. - * <h1 class="header">Internal and Hidden Events</h1> - * Also note that some events are considered to be internally used or hidden. - * <p> - * Internally used events are always "recordable" for notification purposes (regardless of whether they were - * enabled or disabled). But won't be sent down to SPI level if user specifically excluded them. - * <p> - * All discovery events are internal: - * <ul> - * <li>{@link IgniteEventType#EVT_NODE_FAILED}</li> - * <li>{@link IgniteEventType#EVT_NODE_LEFT}</li> - * <li>{@link IgniteEventType#EVT_NODE_JOINED}</li> - * <li>{@link IgniteEventType#EVT_NODE_METRICS_UPDATED}</li> - * <li>{@link IgniteEventType#EVT_NODE_SEGMENTED}</li> - * </ul> - * <p> - * Hidden events are NEVER sent to SPI level. They serve purpose of local - * notification for the local node. - * <p> - * Hidden events: - * <ul> - * <li>{@link IgniteEventType#EVT_NODE_METRICS_UPDATED}</li> - * </ul> - * @see IgniteJobEvent - * @see IgniteCacheEvent - * @see IgniteCachePreloadingEvent - * @see IgniteSwapSpaceEvent - * @see IgniteCheckpointEvent - * @see IgniteDeploymentEvent - * @see IgniteDiscoveryEvent - * @see IgniteTaskEvent - * @see org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...) - */ -public interface IgniteEvent extends Comparable<IgniteEvent>, Serializable { - /** - * Gets globally unique ID of this event. - * - * @return Globally unique ID of this event. - * @see #localOrder() - */ - public IgniteUuid id(); - - /** - * Gets locally unique ID that is atomically incremented for each event. Unlike - * global {@link #id} this local ID can be used for ordering events on this node. - * <p> - * Note that for performance considerations GridGain doesn't order events globally. - * - * @return Locally unique ID that is atomically incremented for each new event. - * @see #id() - */ - public long localOrder(); - - /** - * Node where event occurred and was recorded - * - * @return node where event occurred and was recorded. - */ - public ClusterNode node(); - - /** - * Gets optional message for this event. - * - * @return Optional (can be {@code null}) message for this event. - */ - @Nullable public String message(); - - /** - * Gets type of this event. All system event types are defined in - * {@link IgniteEventType}. - * <p> - * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for - * internal GridGain events and should not be used by user-defined events. - * - * @return Event's type. - * @see IgniteEventType - */ - public int type(); - - /** - * Gets name of this event. All events are defined in {@link IgniteEventType} class. - * - * @return Name of this event. - */ - public String name(); - - /** - * Gets event timestamp. Timestamp is local to the node on which this - * event was produced. Note that more than one event can be generated - * with the same timestamp. For ordering purposes use {@link #localOrder()} instead. - * - * @return Event timestamp. - */ - public long timestamp(); - - /** - * Gets a shortened version of {@code toString()} result. Suitable for humans to read. - * - * @return Shortened version of {@code toString()} result. - */ - public String shortDisplay(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteEventAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteEventAdapter.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteEventAdapter.java deleted file mode 100644 index 1bc4ab6..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteEventAdapter.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.cluster.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -/** - * Base adapter for the events. All events (including user-defined ones) should - * extend this adapter as it provides necessary plumbing implementation details. - */ -public class IgniteEventAdapter implements IgniteEvent { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private final IgniteUuid id = IgniteUuid.randomUuid(); - - /** */ - private final long tstamp = U.currentTimeMillis(); - - /** */ - private ClusterNode node; - - /** */ - private String msg; - - /** */ - private int type; - - /** */ - private long locId = IgniteEventLocalOrder.nextOrder(); - - /** - * No-arg constructor. - */ - public IgniteEventAdapter() { - // No-op. - } - - /** - * Creates event based with given parameters. - * - * @param msg Optional message. - * @param type Event type. - */ - public IgniteEventAdapter(ClusterNode node, String msg, int type) { - assert tstamp > 0; - - A.ensure(type > 0, "Event type ID must be greater than zero."); - - this.node = node; - this.msg = msg; - this.type = type; - } - - /** {@inheritDoc} */ - @Override public int compareTo(IgniteEvent o) { - return o == null ? 1 : id.compareTo(o.id()); - } - - /** {@inheritDoc} */ - @Override public IgniteUuid id() { - return id; - } - - /** {@inheritDoc} */ - @Override public long localOrder() { - return locId; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - assert id != null; - - return this == o || o instanceof IgniteEventAdapter && id.equals(((IgniteEvent)o).id()); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - assert id != null; - - return id.hashCode(); - } - - /** - * Sets node where even is occurred (i.e. node local to the event). - * - * @param node Node. - */ - public void node(ClusterNode node) { - this.node = node; - } - - /** - * Sets optional event message. - * - * @param msg Optional event message. - */ - public void message(@Nullable String msg) { - this.msg = msg; - } - - /** - * Sets event type. - * - * @param type Event type. - */ - public void type(int type) { - this.type = type; - } - - /** {@inheritDoc} */ - @Override public ClusterNode node() { - return node; - } - - /** {@inheritDoc} */ - @Nullable @Override public String message() { - return msg; - } - - /** {@inheritDoc} */ - @Override public int type() { - return type; - } - - /** {@inheritDoc} */ - @Override public long timestamp() { - return tstamp; - } - - /** - * Gets event type name. - * - * @return Event type name. - */ - @Override public String name() { - return U.gridEventName(type()); - } - - /** {@inheritDoc} */ - @Override public String shortDisplay() { - return toString(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteEventAdapter.class, this, "name", name()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2f1c7b39/modules/core/src/main/java/org/apache/ignite/events/IgniteEventLocalOrder.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteEventLocalOrder.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteEventLocalOrder.java deleted file mode 100644 index b6a3e80..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteEventLocalOrder.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import java.util.concurrent.atomic.*; - -/** - * Generator for local atomically incremented IDs for grid events. - */ -final class IgniteEventLocalOrder { - /** Generator implementation. */ - private static final AtomicLong gen = new AtomicLong(0); - - /** - * No-arg constructor enforces the singleton. - */ - private IgniteEventLocalOrder() { - // No-op. - } - - /** - * Gets next atomically incremented local event order. - * - * @return Next atomically incremented local event order. - */ - public static long nextOrder() { - return gen.getAndIncrement(); - } -}