Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8970729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:46:44+00:00 2026-06-15T17:46:44+00:00

To Start: I am a novice in opensource software. (Apache-Tomcat / Java / Restletframework)

  • 0

To Start: I am a novice in opensource software. (Apache-Tomcat / Java / Restletframework)

Here is my question:
I am building a application with the Restlet framework. I do not know if my coding/methody
is Thread-safe!? Can somebody tell me if I am coding the/a right way? Or am I hopelessly failing?

Construct:

  • CLASS A will be called by a client. (the REST-request)
  • CLASS A (the router) will call CLASS B
  • CLASS B is my Central request handler, this CLASS B calls another CLASS C
  • CLASS C is the actual service that was requested, in this example the login-service –

As you can see the login subclass is static. Is this a thread-safe construction?

Regards

CLASS A

public class MyStartApplication extends Application {


//Creates a root Restlet that will receive all incoming calls.

@Override
//public synchronized Restlet createInboundRoot() {    //synchronized?
public  Restlet createInboundRoot() {


    //Create a router that routes each call to a new instance of a Resource.
    Router router = new Router(getContext());

    // First we use MODE_START_WITH to determine the requested destination
    // A TRAPDOOR for all requests for this TEST
    // We reroute it to THE CENTRAL RESTLET-WRAPPER 
TemplateRoute route = router.attach("/testmywrapper/", RestletWrapper.class);
    route.getTemplate().setMatchingMode(Template.MODE_STARTS_WITH);


    // Return the response to caller 
    return router;


}

}

CLASS B

public class RestletWrapper extends ServerResource {

@Get
public JSONObject start()    {

    JSONObject returnObj = null;

    switch(operation){
    case "login":
        returnObj= LoginUser.login(queryparams);
        break;
    }

    Return returnObj
}
}

CLASS C

public class LoginUser {


public static JSONObject login(JSONObject queryparams) throws Exception {
    do some stuff
    return object
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:46:45+00:00Added an answer on June 15, 2026 at 5:46 pm

    Thread safety can be a problem if several threads access some shared state.

    Unless the code hidden behind “do some stuff” uses static fields or singletons, there should be no thread-safety problem: all your variables are local to the login method, and thus not shared between threads.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Novice Programmer here - I have an application with two threads that I start,
Which kind of application would anyone suggest to start working on/developing for a novice
Start to learning Cocos2d and have a question. With moving of the sprite I
i am novice to the Linux shell and had to recently start using it
Before we start, I apologize for my MYSQL novice status. I'm trying to self-teach
i'm quite novice in iphone s/w development i was on an application it requires
I'm a novice android app developer. I wrote an application which fetches Bible Readings
PHP novice here. I would like to ask for a bit of help with
I'm a novice programmer with basic Java experience, and currently learning Python. I've stumbled
First of all, I'm an Objective-C novice. So I'm not very familiar with OS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.