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 9218749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:56:05+00:00 2026-06-18T02:56:05+00:00

I am curious about developing a back-end using the Play Framework in Scala. I’ve

  • 0

I am curious about developing a back-end using the Play Framework in Scala. I’ve only tried the tutorial so far. I was wondering, is it possible to have the different responding “threads” exchange data?

For instance, a counter that counts every time that an HTTP request has been handled. It begins at 0. Then the first request comes in and it becomes 1. At the time of the second requests, the handling “thread” can access that counter somewhere?

This should be achieved without any I/O (files, DB). In Java, it would smell like a static variable, but in Scala? Thank you.

  • 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-18T02:56:07+00:00Added an answer on June 18, 2026 at 2:56 am

    To use a Java static approach take a look at the bellow.
    Otherwise maybe you can make use of the Cache (Both Java and Scala)
    http://www.playframework.org/documentation/2.0.4/ScalaCache

    You can use the a comapnion Object where all you variables will be static.

    class StaticVariables {
    }
    
    object StaticVariables {
     var counter = 0
    }
    

    A Scala worksheet to demonstrate:

    object WorkSheet {
      StaticVariables.counter += 1
      StaticVariables.counter += 1
      println(StaticVariables.counter)                //> 2
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Curious about using app harbor for my web api backed by a neo4j database.
i'm developing a php web application. i'm bit curious about how people store object's
im curious about using schema export fully for my next project. I see it
I'm currently developing a .NET Windows Service and am curious about how references vs.
I'm curious about best practice when developing n-tier application with Linq-to-SQL and WCF service.
I'm thinking about developing an app for OS X using Python. I don't know
I am curious about developing my own Simple Hashing mechanism. I would like to
Curious about running multiple xvfb displays: I have between 10-50 instances of a script
Being curious about how maven works exactly, I've checked out its source codes. Astonishingly,
I'm curious about the correct way to architect an application that consists of the

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.