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

  • Home
  • SEARCH
  • 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 8977295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:20:17+00:00 2026-06-15T19:20:17+00:00

We have recently started using Akka in our software, but most of our code

  • 0

We have recently started using Akka in our software, but most of our code is still “traditional” Java code. I am now in a position where I want to use Akka with existing classes, but can’t rewrite all the existing code that also uses these classes.

In particular, I have a class that manages a map of data objects. The map is already used concurrently by different threads, so the manager class makes sure that all access to the map is synchronized. I now have to create a cleanup job that removes objects from the map after they have become irrelevant. Since this job is supposed to run asynchronously in the background, I use an Akka agent, i.e. I have code that looks more or less like this:

Agent< ObjectManager > myObjectManagerAgent = new Agent< ObjectManager >( myObjectManager, myActorSystem );

...

myObjectManagerAgent.sendOff(
    new Function< ObjectManager, ObjectManager >()
    {
        @Override
        public ObjectManager apply( final ObjectManager objectManager )
        {
           ...

           objectManager.erase( irrelevantObjectIds );

           return objectManager;
        }
     }
  );

However, the same object manager is also written to directly, without the agent, from several other places within the software. As mentioned, this access is thread-safe, but knows nothing of Akka, actors, or agents.

Now my question is: Is this… well, I’m sure it’s not advisable, but will this work? Or am I shooting myself in the foot here? Even if it will work in general, are there potential traps or safety measures I should know about?

  • 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-15T19:20:18+00:00Added an answer on June 15, 2026 at 7:20 pm

    It’s quite normal to use Akka to call into existing code, which is all you’re doing here. You state that the ObjectManager is thread-safe and that other parts of the software use it as well, so there’s no reason to think that introducing Akka will inherently cause problems. On the other hand, you could also move your core logic into an Akka actor, then provide a simple facade over it for your non-Akka consumers.

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

Sidebar

Related Questions

We have recently started using FxCop on our code base and I am in
We recently started using Eclipse to develop our java application and have been running
I have recently started using DocCheck for checking the validity of JavaDoc's in code
I've recently started using GNU Screen but have run into a very annoying problem.
I have recently started using doc-view in Emacs, but I am having quite a
We have recently started using ImageResizer.Net over GDI+ for dynamically resizing images on our
I have recently started looking into using Azure but I'm having some issues getting
I have recently started to learn using of Doctrine 2.0 framework for PHP. Now
I have recently started using PlayN for a hobby project and has now stumbled
I have recently started using R and am still getting used to its data

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.