001/*
002 * JPPF.
003 * Copyright (C) 2005-2018 JPPF Team.
004 * http://www.jppf.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.jppf.node;
019
020import org.jppf.management.*;
021
022/**
023 * Interface for a node that provides information about its activity.
024 * @author Laurent Cohen
025 */
026public interface Node extends Runnable {
027  /**
028   * Get this node's UUID.
029   * @return the uuid as a string.
030   */
031  String getUuid();
032
033  /**
034   * Get the system information for this node.
035   * @return a {@link JPPFSystemInformation} instance.
036   */
037  JPPFSystemInformation getSystemInformation();
038
039  /**
040   * Determine whether this node is local to another component.
041   * @return {@code true} if this node is local, {@code false} otherwise.
042   */
043  boolean isLocal();
044
045  /**
046   * Reset the current task class loader if any is present (i.e. if a job is being executed), without reconnecting to the server.
047   * @param params a (possibly empty) set of arbitrary parameters to propagate to the class loader.
048   * @return the newly created class loader, or {@code null} if none could be created at this time.
049   * This class loader can be safely cast to an {@link org.jppf.classloader.AbstractJPPFClassLoader AbstractJPPFClassLoader}.
050   */
051  ClassLoader resetTaskClassLoader(final Object...params);
052
053  /**
054   * Determine whether this node is running in offline mode.
055   * @return {@code true} if this node is offline, {@code false} otherwise.
056   */
057  boolean isOffline();
058
059  /**
060   * Determine whether this node is a 'master' node for the provisioning features.
061   * @return {@code true} if this node is a master, {@code false} otherwise.
062   */
063  boolean isMasterNode();
064
065  /**
066   * Determine whether this node is a 'slave' node for the provisioning features.
067   * @return {@code true} if this node is a slave, {@code false} otherwise.
068   */
069  boolean isSlaveNode();
070
071  /**
072   * Get the uuid of the node who this node is a slave of.
073   * @return the uuid of this node's master node, or {@code null} if this node is not a slave.
074   * @since 6.0
075   */
076  public String getMasterNodeUuid();
077
078  /**
079   * Determine whether this node can execute .Net tasks.
080   * @return {@code true} if this node can execute .Net tasks, {@code false} otherwise.
081   */
082  boolean isDotnetCapable();
083
084  /**
085   * Determine whether this node is an Android node.
086   * @return {@code true} if this node runs on Android, {@code false} otherwise.
087   */
088  boolean isAndroid();
089
090  /**
091   * Get the JMX connector server associated with the node.
092   * @return a JMXServer instance.
093   * @throws Exception if any error occurs.
094   */
095  JMXServer getJmxServer() throws Exception;
096}