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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:37:11+00:00 2026-05-13T17:37:11+00:00

Hi I have a webapp – and in one method I need to encrypt

  • 0

Hi I have a webapp – and in one method I need to encrypt part of data from request and store them on disk and return response.

Response is in no way related to encryption.

The encryption is quite time demanding however. How to make threads or so properly in this problem?

I tried something like

Thread thread …

thread.start();

or

JobDetail job = encryptionScheduler.getJobDetail(jobDetail.getName(), jobDetail.getGroup());

encryptionScheduler.scheduleJob(jobDetail,TriggerUtils.makeImmediateTrigger(“encryptionTrigger”,1,1)

I tried servlet where before encryption I close the outpuStream.

or: Executors.newFixedThreadPool(1);

But whatever I tried a client has to wait longer.

btw: why is that so? Can it be faster?

I haven’t tried to start thread after context initalization and wait somehow for method needing encryption.

how to speed up this?

thank you

————–EDIT:
//I use axis 1.4, where I have Handler, which in invoke method encrypt a value:

try {
    LogFile logFile = new LogFile(strategy,nodeValue,path, new Date());
    LogQueue.queue.add(logFile);
    }
    catch (Exception e) {
        log.error(e.getMessage(),e);
    }

EExecutor.executorService.execute(new Runnable() {
            public void run() {
                try {
                LogFile poll = LogQueue.queue.poll();
                String strategy = poll.getStrategy();
                    String value = poll.getNodeValue();
                    value = encrypt(strategy,value);
                    PrintWriter writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(poll.getPath(), true )),"UTF-8"));
                    writer.print(value);
                    writer.close();
                }catch (IOException e  ) {
                    log.error(e.getMessage(),e);
                } 
            }

        });
        } catch (Throwable e ) {
            log.error(e.getMessage(),e);
        }

//besides I have executor service

public class EExecutor { public static ExecutorService executorService = Executors.newCachedThreadPool();}

//and what’s really interesting.. when I move encryption from this handler away into another handler which is called
last when I send response! It’s faster. But when I leave it in one of the first handlers when I receive request. It’s even slower without using threads/servlet etc.

  • 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-05-13T17:37:12+00:00Added an answer on May 13, 2026 at 5:37 pm

    The proper way to do something like this is to have a message queue, such as the standard J2EE JMS.

    In a message queue, you have one software component whose job it is to receive messages (such as requests to encrypt some resource, as in your case), and make the request “durable” in a transactional way. Then some independent process polls the message queue for new messages, takes action on them, and transactionally marks the messages as received.

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

Sidebar

Related Questions

I have a webapp development problem that I've developed one solution for, but am
I have a webapp from which I'd like to insert diagrams and images quickly
I have a webapp that sends a SOAP request to a 3rd party server.
I have a webapp embedding some flash content in an iframe. The flash part
I am kind of stuck on this one. I have webapp where I use
I have a webapp on which I need to display unicode characters. It's all
I have a webapp that I am in the middle of doing some load/performance
I have a webapp which resizes its window to exactly fit its contents: window.resizeTo(200,300)
I have a webapp being hosted with a public hosting company, the site is
We have a webapp where people can upload various image file types and on

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.