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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:42:51+00:00 2026-06-03T03:42:51+00:00

About project: I’m trying to write CMS-like web-site on Java. Previously I used PHP

  • 0

About project:
I’m trying to write CMS-like web-site on Java. Previously I used PHP for such purposes, but now I need tight integration with existing server-side solution, written on java, so decided to use Java for web-site too. Currently, for easier developing, I made some “hierarchy” of my project: top-level “Server” class (in closest future it’ll be filled with content and functionality, but now it’s empty), next Subsystems, Extensions, and as a part of any of this – Modules and Blocks. Each of them have some restrictions and possibilities, not available to one another… Maybe there is other way, but currently I don’t know it.

I’m making some kind of caching, depending on the fact, that mine Dynamic Web Project’s vars can be kept in the memory all the time. For example, ‘Tree’, that represents all this elements, loaded from database and kept in memory, and all next requests (for example, what Extension has this Module as a child – for managing privileges) made without asking database.

Of course, for this purposes, I need to have some flag, that will tell elements, that their data was changed and they need to refresh it from database. Single global flag (in context, for example) is bad, while in almost all situations I’ll need to refresh single element or group. Single element’s flag is done, but…

About realization:
The problem itself. Lets say I have class Module:

public abstract class Module{
    private final static boolean Changed;
    public static boolean getChanged(){
        return Changed;}
    public static void setChanged(boolean newState){
        Changed = newState;}
    public abstract String getName();
    public abstract String getTitle(HttpServletRequest request,
        HttpServletResponse response, ServletContext context);}

And I have some module:

public final class Articles extends Module{
    public class Article{...}
    private Tree<Article> ArticleList;
    public final ArrayList<Article> getArticlesInGroup(int groupID){
        if(getChanged())
            refreshFromDatabase();
        ...
    }
}

Here, for example, this flag used as in case of changing some global preferences, that may change Articles work – for example, some operations on database, that performed through Query browser or some else – class ‘caching’ a tree of articles and groups (it doesn’t keeping whole article – only Title, ID, ParentGroup or maybe some else…

The problem itself: in servlet Main in doGet(…) I have next code executed:

if(request.getParameter("SetModify") && UsersManager.inGroup(currentUser,"Administrator")
    Module.setChanged(true);

And, I checked, “Module.setChanged(true)” executed successfully… But when it comes to “getChanged()” in class Article, I got false…

Does there exists any way to create static variable, that will be static among all class, that extends it, or I simply doesn’t understand something? Case “Module.getChanged()” in class Articles tested as well – the result is the same…

  • 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-03T03:42:52+00:00Added an answer on June 3, 2026 at 3:42 am

    I’m surprised that your code compiles since you use the ‘final’ keyword here:

    private final static boolean Changed;
    

    Generally you shouldn’t be able to modify members declared as final. so the setter shouldn’t be allowed:

    public static void setChanged(boolean newState){
         Changed = newState;}
    

    Protip: you might want to look into a more full fledged system like EhCache with Spring to decouple all this ‘optimization’ of data base access from the actual code.

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

Sidebar

Related Questions

My project is about a school admin I have a page called : createClass.php,
I'm doing a project about cooking recipes with PHP(with Codeigniter) and MYSQL. I have
Does google code provide an API for accessing information about a project like github
My multi-module Maven project looks like: /foo pom.xml /foo-parent /foo-core /foo-something /src /site Pay
I'm thinking about a project, where I need such informations as described in the
I'm trying to find the overview about Grails project structure, as fully as possible.
Just about every Java project that I've seen either uses Maven or Ant. They
I read about a project that enables the developer to program a HTML5 web
im working on a project about a web-based system. I have a form, i
I'm trying to work on a project about page ranking. I want to make

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.