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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:04:15+00:00 2026-05-26T18:04:15+00:00

I am taking a look at Java’s delivered code for Deflater . I notice

  • 0

I am taking a look at Java’s delivered code for Deflater. I notice that all methods accessing the ZStreamRef object created natively are synchronizing access to it. For example:

public void setLevel(int level) {
if ((level < 0 || level > 9) && level != DEFAULT_COMPRESSION) {
    throw new IllegalArgumentException("invalid compression level");
}
    synchronized (zsRef) {
        if (this.level != level) {
            this.level = level;
            setParams = true;
        }
    }
}

Yet, the Javadoc does not mention that Deflater is thread safe. Is it a requirement to synchronize natively created objects before accessing them?

  • 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-26T18:04:16+00:00Added an answer on May 26, 2026 at 6:04 pm

    The documentation doesn’t state that it need to be thread safe, and it might not be thread safe on all platforms. However in the OpenJDK it is. Not sure it is very useful however as its stateful and would almost certainly require external locking to share the stream between threads. (Which I doubt is a good idea)

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

Sidebar

Related Questions

I was taking a look through some open-source C++ code and I noticed a
I am currently working on some Java code that has a lot of ActionListeners
I have an idea to write a note-taking app in Java that does some
The question says it all. I was taking a look at Can a recursive
After taking a look at some old code: //Nothing like a destructor!! function destroy()
Taking a look at my question HERE , I now want to return the
After taking a look at this SO question and doing my own research, it
I've been taking a look at some different products for .NET which propose to
I'm taking a look at how the model system in django works and I
I was taking a look at http://www.zenfolio.com/zf/features.aspx and I can't figure out how they

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.