congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Agent.getName
Code IndexAdd Tabnine to your IDE (free)

How to use
getName
method
in
org.rhq.core.domain.resource.Agent

Best Java code snippets using org.rhq.core.domain.resource.Agent.getName (Showing top 20 results out of 315)

origin: org.rhq/rhq-core-domain

public PartitionEventDetails(PartitionEvent partitionEvent, Agent agent, Server server) {
  this.partitionEvent = partitionEvent;
  this.agentName = agent.getName();
  this.serverName = server.getName();
}
origin: org.rhq/rhq-enterprise-server

@SuppressWarnings("unused")
private void logServerList(String debugTitle, Map<Agent, List<ServerBucket>> agentServerListMap) {
  //if (!log.isInfoEnabled())
  //    return;
  StringBuilder sb = new StringBuilder("\nServerList (");
  sb.append(debugTitle);
  sb.append(") :");
  for (Agent agent : agentServerListMap.keySet()) {
    sb.append("\n\n Agent: " + agent.getName());
    for (ServerBucket bucket : agentServerListMap.get(agent)) {
      sb.append("\n   ");
      sb.append(bucket.assignedLoad);
      sb.append(" : ");
      sb.append(bucket.server.getName());
    }
  }
  sb.append("\n\n");
  System.out.println(sb.toString());
  log.info(sb.toString());
}
origin: org.rhq/rhq-enterprise-server

@ExcludeDefaultInterceptors
public void deleteAgent(Agent agent) {
  agent = entityManager.find(Agent.class, agent.getId());
  failoverListManager.deleteServerListsForAgent(agent);
  entityManager.remove(agent);
  Query q = entityManager.createNamedQuery(AgentInstall.QUERY_DELETE_BY_NAME);
  q.setParameter("agentName", agent.getName());
  q.executeUpdate();
  destroyAgentClient(agent);
  LOG.info("Removed agent: " + agent);
}
origin: org.rhq/rhq-enterprise-server

/**
 * Returns a configuration that can be used for the the client command sender that will talk to the given agent.
 *
 * @param  agent
 *
 * @return configuration for a {@link ClientCommandSender} that will talk to the given agent
 */
private ClientCommandSenderConfiguration getSenderConfiguration(Agent agent) {
  ServerConfiguration server_config = getConfiguration();
  ClientCommandSenderConfiguration client_config = server_config.getClientCommandSenderConfiguration();
  // make sure it uses a unique spool file.  Senders cannot share spool files; each remote endpoint
  // must have its own spool file since the spool file contains command requests for a single, specific, agent.
  // (a null spool filename means we will never guarantee message delivery to agents)
  if (client_config.commandSpoolFileName != null) {
    File spool_file = new File(client_config.commandSpoolFileName);
    String file_name = spool_file.getName();
    String parent_path = spool_file.getParent();
    spool_file = new File(parent_path, agent.getName() + "_" + file_name);
    client_config.commandSpoolFileName = spool_file.getPath();
  }
  return client_config;
}
origin: org.rhq/rhq-enterprise-server

@Override
public boolean pingService(long timeoutMillis) {
  try {
    // create our own factory so we can customize the timeout
    ClientRemotePojoFactory factory = sender.getClientRemotePojoFactory();
    factory.setTimeout(timeoutMillis);
    PingAgentService pinger = factory.getRemotePojo(PingAgentService.class);
    long agentTime = pinger.ping();
    long skew = Math.abs(System.currentTimeMillis() - agentTime);
    if (skew > 5 * 60 * 1000L) {
      LogFactory.getLog(this.getClass()).debug(
        "Agent [" + agent.getName() + "] either took a long time to process a ping (" + skew
          + "ms) or its clock is not synced: " + new Date(agentTime));
    }
    return true;
  } catch (Exception e) {
    return false;
  }
}
origin: org.rhq/rhq-enterprise-server

@RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
  @RequiredPermission(Permission.MANAGE_INVENTORY) })
public void removeAgentsFromGroup(Subject subject, Integer[] agentIds) {
  List<Integer> agentIdsList = Arrays.asList(agentIds);
  Query query = entityManager.createNamedQuery(AffinityGroup.QUERY_UPDATE_REMOVE_SPECIFIC_AGENTS);
  query.setParameter("agentIds", agentIdsList);
  query.executeUpdate();
  // Audit each changed affinity group assignment (is this too verbose?)
  for (Integer agentId : agentIdsList) {
    Agent agent = entityManager.find(Agent.class, agentId);
    partitionEventManager.auditPartitionEvent(subject, PartitionEventType.AGENT_AFFINITY_GROUP_REMOVE, agent
      .getName());
  }
  // Now, request a cloud repartitioning due to the affinity group changes
  partitionEventManager.cloudPartitionEventRequest(subject, PartitionEventType.AFFINITY_GROUP_CHANGE,
    PartitionEventType.AGENT_AFFINITY_GROUP_REMOVE.name());
}
origin: org.rhq/rhq-enterprise-server

@RequiredPermissions({ @RequiredPermission(Permission.MANAGE_SETTINGS),
  @RequiredPermission(Permission.MANAGE_INVENTORY) })
public void addAgentsToGroup(Subject subject, int affinityGroupId, Integer[] agentIds) {
  List<Integer> agentIdsList = Arrays.asList(agentIds);
  AffinityGroup group = entityManager.find(AffinityGroup.class, affinityGroupId);
  Query query = entityManager.createNamedQuery(AffinityGroup.QUERY_UPDATE_ADD_AGENTS);
  query.setParameter("affinityGroup", group);
  query.setParameter("agentIds", agentIdsList);
  query.executeUpdate();
  // Audit each changed affinity group assignment (is this too verbose?)
  String auditString = group.getName() + " <-- ";
  for (Integer agentId : agentIdsList) {
    Agent agent = entityManager.find(Agent.class, agentId);
    partitionEventManager.auditPartitionEvent(subject, PartitionEventType.AGENT_AFFINITY_GROUP_ASSIGN,
      auditString + agent.getName());
  }
  // Now, request a cloud repartitioning due to the affinity group changes
  partitionEventManager.cloudPartitionEventRequest(subject, PartitionEventType.AFFINITY_GROUP_CHANGE, group
    .getName());
}
origin: org.rhq/rhq-enterprise-server

if (agent.getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)
  && agent.getAgentToken().startsWith(ResourceHandlerBean.DUMMY_AGENT_TOKEN_PREFIX)) {
  return Collections.<MeasurementData> emptySet();
origin: org.rhq/rhq-enterprise-server

} catch (Throwable t) {
  if (log.isDebugEnabled()) {
    log.debug("Tried to immediately sync agent[name=" + agent.getName()
      + "] with error-corrected schedules failed");
origin: org.rhq/rhq-enterprise-server

@Override
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void setResourceAvailabilities(Map<Agent, int[]> map, AvailabilityType avail) {
  long now = System.currentTimeMillis();
  for (Agent agent : map.keySet()) {
    AvailabilityReport report = new AvailabilityReport(true, null);
    report.setServerSideReport(true);
    for (int resourceId : map.get(agent)) {
      report.addAvailability(new Datum(resourceId, avail, now));
    }
    AvailabilityReportSerializer.getSingleton().lock(agent.getName());
    try {
      this.availabilityManager.mergeAvailabilityReport(report);
    } finally {
      AvailabilityReportSerializer.getSingleton().unlock(agent.getName());
    }
  }
  return;
}
origin: org.rhq/rhq-enterprise-server

throws InvalidInventoryReportException, StaleTypeException {
InventoryReportSerializer.getSingleton().lock(report.getAgent().getName());
try {
  long start = System.currentTimeMillis();
  InventoryReportSerializer.getSingleton().unlock(report.getAgent().getName());
origin: org.rhq/rhq-enterprise-server

@RequiredPermission(Permission.MANAGE_INVENTORY)
public FailoverListComposite agentPartitionEvent(Subject subject, String agentName, PartitionEventType eventType,
  String eventDetail) {
  if (eventType.isCloudPartitionEvent() || (null == agentName)) {
    throw new IllegalArgumentException("Invalid agent partition event or no agent specified for event type: "
      + eventType);
  }
  Agent agent = agentManager.getAgentByName(agentName);
  if (null == agent) {
    throw new IllegalArgumentException("Can not perform partition event, agent not found with name: "
      + agentName);
  }
  PartitionEvent partitionEvent = new PartitionEvent(subject.getName(), eventType, eventDetail,
    PartitionEvent.ExecutionStatus.IMMEDIATE);
  partitionEventManager.createPartitionEvent(subject, partitionEvent);
  return failoverListManager.getForSingleAgent(partitionEvent, agent.getName());
}
origin: org.rhq/rhq-enterprise-server

if (resourceIdWithAgent.getAgent().getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)
  && resourceIdWithAgent.getAgent().getAgentToken()
    .startsWith(ResourceHandlerBean.DUMMY_AGENT_TOKEN_PREFIX)) {
origin: org.rhq/rhq-enterprise-server

AvailabilityReport report = reports.get(agent);
if (null == report) {
  report = new AvailabilityReport(agent.getName());
  report.setEnablementReport(true);
  reports.put(agent, report);
origin: org.rhq/rhq-enterprise-server

AvailabilityReport report = reports.get(agent);
if (null == report) {
  report = new AvailabilityReport(agent.getName());
  report.setEnablementReport(true);
  reports.put(agent, report);
origin: org.rhq/rhq-enterprise-server

result.put("Agent " + agent.getName(), agent.toString());
origin: org.rhq/rhq-core-plugin-container

@Override
@NotNull
public AvailabilityReport getCurrentAvailability(Resource resource, boolean changesOnly) {
  try {
    //make sure we have the full version of the resource
    ResourceContainer container = getResourceContainer(resource.getId());
    if (container == null) {
      //don't bother doing anything
      return new AvailabilityReport(changesOnly, getAgent().getName());
    }
    resource = container.getResource();
    MeasurementScheduleRequest availSchedule = container.getAvailabilitySchedule();
    boolean forceScanForRoot = availSchedule == null || availSchedule.isEnabled();
    // force scan for root resource only if availability schedule is enabled 
    AvailabilityExecutor availExec = new CustomScanRootAvailabilityExecutor(this, resource, forceScanForRoot);
    if (changesOnly) {
      availExec.sendChangesOnlyReportNextTime();
    } else {
      availExec.sendFullReportNextTime();
    }
    return availabilityThreadPoolExecutor.submit((Callable<AvailabilityReport>) availExec).get();
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new RuntimeException("Availability scan execution was interrupted", e);
  } catch (ExecutionException e) {
    // Should never happen, reports are always generated, even if they're just to report the error
    throw new RuntimeException("Unexpected exception", e);
  }
}
origin: org.rhq/rhq-core-plugin-container

availabilityReport = new AvailabilityReport(changesOnly, inventoryManager.getAgent().getName());
origin: org.rhq/rhq-enterprise-server

@PUT
@Path("/{id}/availability")
@ApiOperation("Set the current availability of the passed resource")
@TransactionAttribute(TransactionAttributeType.NEVER)
public void reportAvailability(@ApiParam("Id of the resource to update") @PathParam("id") int resourceId,
      @ApiParam(value= "New Availability setting", required = true) AvailabilityRest avail) {
  if (avail.getResourceId() != resourceId)
    throw new IllegalArgumentException("Resource Ids do not match");
  Resource resource = fetchResource(resourceId);
  AvailabilityType at;
  at = AvailabilityType.valueOf(avail.getType());
  // According to jshaughn, plaforms must not be set to DISABLED, so catch this case here.
  if (resource.getResourceType().getCategory()==ResourceCategory.PLATFORM && at==AvailabilityType.DISABLED) {
    throw new BadArgumentException("Availability","Platforms must not be set to DISABLED");
  }
  Agent agent = agentMgr.getAgentByResourceId(caller,resourceId);
  AvailabilityReport report = new AvailabilityReport(true, agent.getName());
  Availability availability = new Availability(resource, avail.getSince(), at);
  report.addAvailability(availability);
  availMgr.mergeAvailabilityReport(report);
}
origin: org.rhq/rhq-enterprise-server

agent.getName();
org.rhq.core.domain.resourceAgentgetName

Javadoc

The agent's name will usually, but is not required to, be the fully qualified domain name of the machine where the agent is running. In other words, the #getAddress(). However, there is no technical reason why you cannot have an agent with a name such as "foo". In fact, there are use-cases where the agent name is not the same as the address (e.g. perhaps you expect the machine to periodically change hostnames due to DNS name changes and so you want to name it something more permanent).

Agent names must be unique - no two agents can have the same name.

Popular methods of Agent

  • <init>
    Constructor for Agent.
  • equals
  • generateAgent
  • getAddress
    Returns the machine address that is used to connect to the agent. This can be either an IP address o
  • getAffinityGroup
    Returns the AffinityGroup this agent currently belongs to.
  • getAgentToken
    Returns the token string that allows the agent to talk back to the server. If the agent provides an
  • getId
  • getInner
  • getNameAndNeighbor
  • getPort
    Returns the port number that the agent is listening to when accepting messages from the server.
  • getRemoteEndpoint
    The remote endpoint is the full connection string that is to be used to connect to the agent. If nul
  • getServer
    Returns the Server this agent is currently communicating to.
  • getRemoteEndpoint,
  • getServer,
  • getStatus,
  • introduce,
  • isBackFilled,
  • placeOrder,
  • printWithTrace,
  • sayHelloTo,
  • setAddress

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Table (org.hibernate.mapping)
    A relational table
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now