Quantcast
Channel: BitNami Answers - latest questions
Viewing all articles
Browse latest Browse all 2052

Session taking too long to get

$
0
0

Hi, I am using OpenCMIS to connect to Alfresco in a tomcat server where Alfresco and my app reside as two webapps. Alfresco is fully configured and at version 4.0.e-0 on the bitNami server instance. My session creation is taking around 6-18 seconds and changing AtomPub URL did not make it better. Any help in getting it faster is appreciated. I want to use OpenCMIS atomPub because it is easier to deal with than CmisBindingFactory based creation of Services and working with repositories and content.

    private static String SYSTEM_USER = "user";
private static String SYSTEM_PASSWORD = "bitnami";
private static String ALFRESCO_ATOMPUB_URL = "http://localhost/alfresco/service/cmis";
private static String MY_REPOSITORY_ID = "6fc5fef4-88ff-Xxxxxxxxxxxxxxxxx";

private static String Ticket = "";
private static AuthenticationServiceSoapBindingStub authenticationService = null;
private static Session alfresco_Session = null;
private static CmisBinding cmis_binding = null;

public Session getAtomSession() {

    if(alfresco_Session != null) return alfresco_Session;

    long time1 = System.currentTimeMillis();
    SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
    long time3 = System.currentTimeMillis();
    log.debug("Time for sessionfactory impl: " +(time3-time1)+" ms");
    Map<String, String> parameter = new HashMap<String, String>();
    parameter.put(SessionParameter.USER, SYSTEM_USER);
    parameter.put(SessionParameter.PASSWORD, SYSTEM_PASSWORD);
    parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
    parameter.put(SessionParameter.ATOMPUB_URL, ALFRESCO_ATOMPUB_URL);
    parameter.put(SessionParameter.AUTH_HTTP_BASIC, "true" );
    //parameter.put(SessionParameter.COOKIES, "true" );

    /*
    List<Repository> repositories = new ArrayList<Repository>();
    repositories = sessionFactory.getRepositories(parameter);

    Repository repository = repositories.get(0);
    log.debug("REPOSITORY_ID: "+repository.getId());*/
    parameter.put(SessionParameter.REPOSITORY_ID, MY_REPOSITORY_ID);

    alfresco_Session = sessionFactory.createSession(parameter);

    //log.debug("Got a connection to repository: " + repository.getName() + ", with id: " + repository.getId());
    long time2 = System.currentTimeMillis();
    long difftime = time2 - time1;
    log.debug("Time Taken for Atom Session: "+difftime+" ms.");
    return alfresco_Session;
}

Viewing all articles
Browse latest Browse all 2052

Trending Articles