Get a remote session from the pool and initialize it.
If the pool is empty, create a new remote session.
@param strUserID The user name/ID of the user, or null if unknown.
@return The remote Task.
549738
public RemoteTask getNewRemoteTask(Application app, Map<String,Object> properties)
    {
        try   {
            // Map<String,Object> propApp = this.getApplicationProperties(properties);

            // Map<String,Object> propInitial = ProxyTask.getInitialProperties(this.getBasicServlet(), SERVLET_TYPE.PROXY);
            // if (propInitial != null)
            //	propApp.putAll(propInitial);
            
            if (app == null)
                app = new MainApplication(((BaseApplication)m_application).getEnvironment(), properties, null);	// propApp, null);
            RemoteTask remoteServer = new TaskSession(app);
            ((TaskSession)remoteServer).setProperties(properties);
            return remoteServer;
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
691667
public void setReturnSessionOrObject(PrintWriter out, Object objReturn)
    {
        String strID = null;
        String strSessionClass = null;
        if (objReturn instanceof RemoteTable)
        {
            strSessionClass = REMOTE_TABLE;
            strID = this.add(new TableHolder(this, (RemoteTable)objReturn));
        }
        else if (objReturn instanceof RemoteSession)
        {
            strSessionClass = REMOTE_SESSION;
            strID = this.add(new SessionHolder(this, (RemoteSession)objReturn));
        }
        else if (objReturn instanceof RemoteBaseSession)
        {
            strSessionClass = REMOTE_BASE_SESSION;
            strID = this.add(new BaseSessionHolder(this, (RemoteBaseSession)objReturn));
        }
        if (strID != null)
            this.setReturnString(out, strSessionClass + CLASS_SEPARATOR + strID);
        else
            this.setReturnObject(out, objReturn);
    }
226133
protected void remoteInit() throws JMSException
    {
        CreateConsumerQuery query = new CreateConsumerQuery();
        query.setConsumerId(id);
        query.setSessionId(session.getId());
        query.setDestination(destination);
        query.setMessageSelector(messageSelector);
        query.setNoLocal(noLocal);
        transportEndpoint.blockingRequest(query);        
    }
1049566
@Override
	public final Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
        if (!transacted && acknowledgeMode == Session.SESSION_TRANSACTED)
            throw new FFMQException("Acknowledge mode SESSION_TRANSACTED cannot be used for an non-transacted session","INVALID_ACK_MODE");
        
        externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        RemoteSession session = new RemoteSession(idProvider.createID(),
	        		                                  this,
	                                                  transportHub.createEndpoint(),
	                                                  transacted,
	                                                  acknowledgeMode);
	        registerSession(session);
	        session.remoteInit();
	        return session;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
628597
@Override
	public final Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
    {
    	return createSession(idProvider.createID(), transacted, acknowledgeMode);
    }
365878
public ValidationSessionInfo createSession(HttpServletRequest req, HttpServletResponse res) {
        String key = this.getSessionKey();
        ValidationSessionInfo sessionInfo = new ValidationSessionInfo(req, key);
        this.sessionMap.put(key, sessionInfo);
        res.addCookie(new Cookie("AuthToken", key));
        return sessionInfo;
    }
1172573
public BaseMessageSender createMessageSender()
    {
        RemoteTask server = (RemoteTask)((App)this.getMessageManager().getApplication()).getRemoteTask(null);
        try   {
            return new RemoteMessageSender(server, this);
        } catch (RemoteException ex)    {
            ex.printStackTrace();
        }
        return null;
    }
1369107
public static SSHService getFromCache(SessionResource<Map<String, SSHConnection>> sessionResource, String sessionId) {
        Session savedSession = CacheUtils.getSshSession(sessionResource, sessionId);
        if (savedSession != null && savedSession.isConnected()) {
            Channel savedChannel = CacheUtils.getSshChannel(sessionResource, sessionId);
            return new SSHServiceImpl(savedSession, savedChannel);
        }

        return null;
    }
341080
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException
    {
        Utility.getLogger().info("createRemoteTask()");
        RemoteTask remoteTask = this.getNewRemoteTask(properties);
        return remoteTask;
    }
1168168
protected HttpSession createSession(final HttpServletRequest servletRequest) {

        LOGGER.debug("Returning an authenticated session in the default workspace");
        return  new HttpSession(repo.login(credentialsService.getCredentials(servletRequest)));
    }
261366
public Task<RemoteInsertOneResult> insertOne(final DocumentT document) {
    return dispatcher.dispatchTask(new Callable<RemoteInsertOneResult>() {
      @Override
      public RemoteInsertOneResult call() {
        return proxy.insertOne(document);
      }
    });
  }
551175
public RemoteTask getNewRemoteTask(Map<String,Object> properties)
    {
        try   {
            if (m_app != null)
            {   // Make sure remote server has same db properties, etc.
                Map<String,Object> appProperties = m_app.getProperties();
                properties = Utility.copyAppProperties(properties, appProperties);
            }
            Application app = new MainApplication(((BaseApplication)m_app).getEnvironment(), properties, null);
            RemoteTask remoteServer = new TaskSession(app);
            ((TaskSession)remoteServer).setProperties(properties);
            return remoteServer;
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
730094
protected void remoteInit() throws JMSException
    {
        CreateBrowserQuery query = new CreateBrowserQuery();
        query.setBrowserId(id);
        query.setSessionId(session.getId());
        query.setQueue(queue);
        query.setMessageSelector(messageSelector);
        transportEndpoint.blockingRequest(query);
    }
316532
public TaskInfo createTask(ManagedObject obj, String taskTypeId, String initiatedBy, boolean cancelable) throws RuntimeFault, RemoteException {
        return createTask(obj, taskTypeId, initiatedBy, cancelable, null);
    }
1268963
public SessionInfo getLockSessionInfo(Task objSession, String strUserName)
    {
        if (objSession == null)
        {
            Utility.getLogger().warning("null session");
            return new SessionInfo(0, strUserName);     // 
        }
        SessionInfo intSession = (SessionInfo)m_hmLockSessions.get(objSession);
        if (intSession == null)
            m_hmLockSessions.put(objSession, intSession = new SessionInfo(m_iNextLockSession++, strUserName));
        return intSession;
    }
535768
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
      throws RemoteException {
    // Get the UserService.
    UserServiceInterface userService = adManagerServices.get(session, UserServiceInterface.class);

    // Get all roles.
    Role[] roles = userService.getAllRoles();

    int i = 0;
    for (Role role : roles) {
      System.out.printf(
          "%d) Role with ID %d and name '%s' was found.%n", i++, role.getId(), role.getName());
    }

    System.out.printf("Number of results found: %d%n", roles.length);
  }
371177
public BoxRequestsFile.GetUploadSession getUploadSession(String uploadSessionId) {
        return new BoxRequestsFile.GetUploadSession(uploadSessionId, getUploadSessionInfoUrl(uploadSessionId), mSession);
    }