EJB / EE :: When Timer Data In Cache Is Updated On One Server / How To Make It Synchronize To Other Servers

Oct 31, 2014

Our company has a web based project which using the Jboss EAP 6.1 +EJB 3.1 + JSF2 and deployed it in a cluster environment(Server A,Server B and Server C).We have created some schedule tasks by using EJB timer service and the timer data file is stored in a central file system.And users can login and access to a task configuration page to customise his own tasks by create,update,delete actions etc.But we find that the timers don't work correctly in the cluster environment.

For example.When we start the Servers(A,B,C),each server will load the timer file data into his own node cache from the central file system.But when one user go to the task configuration page to update or delete his own tasks from one of the Servers, it only update the change on its own node cache and don't replicate the timer data to other nodes' cache and which cause the problem.

I know there is one way to fix it is that we could shutdown the three Servers and re-boot them and the timer data file will be re-loaded into each server's cache. But we can't do that because the users want their own created/updated tasks take effect immediately once they change them.My question is that when the timer data in cache is updated on one server, how to make it synchronize to the other Servers'.

View Replies


ADVERTISEMENT

Enterprise JavaBeans :: How To Refresh JPA Data When Table Data Is Updated From Backend

Nov 27, 2012

Is there a way to inform the Entity Manager or force the JPA provider to reload data from the database? The scenario could be data being updated by a store procedure or direct SQLPlus maintenance, without restarting the Application Server, the JPA need to load the newly updated data from the database.

I think the current JPA API is not enough. The void refresh(java.lang.Object entity) from EntityManager need to pass in the Entity object, I will like to know how to refresh the entire JPA Entity data after the physical table data being update from backend.

View Replies View Related

How To Cache Data Reading From Collection Of Text Files In A Directory Using TreeMap

May 4, 2015

How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class? These are the keys,values: TreeMap The data I'd like to Cache is (date from the file, time of the file, current time).
 
import java.io.*; 
public class CacheData {
  public static void main(String[] args) throws IOException {
  String target_dir = "C:Files";
  String output = "C:Filesoutput.txt";
  File dir = new File(target_dir);
  File[] files = dir.listFiles();
 
 [Code] ....

View Replies View Related

Swing/AWT/SWT :: JTable - How To Repaint With Updated Data

Jun 5, 2014

Here's what I would like to happen:

Java/Swing dialog box appears on the user's screenIt allows the user to enter 2 values into labelled text fields (fname/sname)They select a "Click Me" push button which I hope will write the data into the table. But the table does not get refreshed.

If I minimise the dialog box and then open it again, the data still does not appear.

The code I originally built using eclipse/WindowBuilder. I've cut it back and tried to isolate the issue. But I still cannot figure it out.

I've added some diagnostic log messages to ensure that I am seeing the various events I think I need to see and have put code in the action callbacks etc.

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;

[Code] .....

View Replies View Related

Servlets :: Setting A Timer Task Even If Server Restarts

Jun 10, 2014

I have a web app that accepts requests. Once a request is sent, I want to create a thread that will sleep for several days if no user action is taken on the request to remind the user to do something. The problem is, how do I ensure the timer will pick up at the same place if the server is restarted? Would serializing the thread do that? I'm guessing no because I think you're just creating a new instance at start up. Just checking If there's anything built into Java to do this.

View Replies View Related

Synchronize UDP Sending And Receiving

Apr 16, 2015

Say I was to make a computer game, the first person to play the game would have a joinable game and would then be the server, and anyone joining in would be the client and the server was updated with JSON data of the clients computer game, and the server would then update each client of each characters new data using JSON, I would need fast multi threaded connection handling with minimum overhead, Is there a specific way to do this? or are there many?

I have realized there are a few ways to send and receive data using UDP and while experimenting I have also found its quite hard to synchronise.

Do I have a connection listening until there is data to be sent and then switched back to listening?

Do I have the server listening for a microsecond and then checking to see of there's anything to send for a microsecond continuously?

Do I have multiple connections for sending and receiving

Do I create new connections for each new and individual packets to be sent and received dynamically on a thread?

What is the optimum most effective way and do my examples reflect much understanding at all? my resent attempts create new problems and rather than re invent the wheel I would like to know what is normally done.

View Replies View Related

Make Http Server Creation Public

Mar 3, 2015

Now, I would like to properly stop the server. For that, I can do server.stop(); . However, this does not work since the object server is not public, it is contained within the public pc_proxy class.How do I do that?

Java Code: import java.net.*;
import java.io.*;
import com.sun.net.httpserver.*;
import java.util.concurrent.Executors;
import java.lang.reflect.Array;

[code]....

View Replies View Related

JavaFX 2.0 :: Synchronize Model Representing Complex UI Composite With FlowPane Backing List

Aug 26, 2014

What is the best way to synchronize a Model representing a complex UI composite w/ a FlowPane's backing list?
 
Currently I have a change listener on the Model.  Upon an add I create a new UI composite and manually add it to the FlowPane's backing list via flowPane.getChildren().add().  Similarly if there is a remove, I iterate over the FlowPane's children, grab the right Node, and remove it.  Similarly, if there is a modification detected, I iterate over the FlowPane's children, grab the right Node, remove it, recreate the UI composite, and re-add it to the list.  I also need the list to be sorted, so I implemented a UIComposite comparator and call FXCollections.sort() on the FlowPane's backing list.  I feel like that is hacky, but it works.  It would be cool if I could maintain sort order in my model somehow and have that automatically propogated to the FlowPane's list.
 
I am correct in assuming that there is no way to have a complex binding in between an ObservableList<CompositeViewModel> and the FlowPane's backing list (ObservableList<T>)? 

Some kind of translator that could create a new UIComposite whenever there is a new CompositeViewModel added to the Model list.

View Replies View Related

Servlets :: How To Send Json Data From A Server

Aug 11, 2014

I'm new to json and the web. My purpose is to use json data from a server and parse it and show meaningful data to the user. I am aware of json parsing, so no sweat there. However, I would like to know how json data is sent to the front end after which it can be parsed.

Usually in my json parsing examples, I have a variable like var data = ]OR I do a getJSON on a data.json file which I have stored in the project folder. However, I want this data to come real time from a servlet. How to go about this?

So, basically my question is, how do I send real time json data from a servlet backend, say some records which I have extracted from the database using jdbc?

View Replies View Related

Trying To Build A Simple Cache Memory

Mar 29, 2015

Started ok i guess? But when it comes to the save and get methods im totaly lost.. (See the code)

import java.util.HashMap;
public class Model {
HashMap<Integer,Long> m = new HashMap<Integer,Long>();
Integer value;
Long result = 2 * computePower(value-1);
public long computePower(int value){
if(value <= 0 )

[Code] .....

View Replies View Related

Reading Data From Socket / Responses Of Python Server

Nov 3, 2014

I'm having a lot of problems reading data from a socket. I'm trying to read the responses of a python server. I've a

BufferedReader inputStream = new BufferedReader( new InputStreamReader(socket.getInputStream()));

And then:

char[] messageChunk=new char[32768]; //32768
List<Byte> messageBytesList = new ArrayList<Byte>();
while (inputStream.ready()) {
inputStream.read(messageChunk, 0, 32768);
for(int k=0;k<32768;k++){
messageBytesList.add((byte)messageChunk[k]);
}
}

inside a thread. Then I convert the list of bytes to a byte array using:

Byte[] messageBytes = messageBytesList.toArray(new Byte[messageBytesList.size()]);
byte[] message = ArrayUtils.toPrimitive(messageBytes);

The problem is that I often receive ArrayOutOfBound errors when I try to parse the byte array. I think that I'm reading from the socket in a wrong way..

View Replies View Related

Servlets :: Two Application Servers - Session Replication

Jun 20, 2014

My application has two Application servers, App1 and App2..

We are using weblogic 8.1 Application server

There is session replication done in weblogic.xml file .

<session-descriptor>
<session-param>
<param-name>InvalidationIntervalSecs</param-name>
<param-value>1</param-value>

[Code] ....

The application works fine but currently there is data getting replicated among different users. Is it the problem of session data getting merged with other session data or is it server cache not getting cleared or is there any setting to be changed in weblogic application server??

View Replies View Related

EJB / EE :: How Many Application Servers Are There If Multiple Applications Hosted On Domain

Mar 6, 2015

Because there's little information that actually explains application servers in the real world, For one domain at www.url.com:

- How many application servers are there if there are multiple applications hosted on this domain? Ie. url.com/app1, url.com/app2, etc.?

- How many web servers will there be?

- How would I make one physical server handle all requests for one of the above applications?

- How would one make static content a standalone application built with angularJS? Not static content served by servlets.

View Replies View Related

JavaWs - Importing Two JNLP Files Into System Cache

May 8, 2014

Have an issue with deploying our application, which comes in two parts, with javaws . In our installer (which is coded in NSIS) we call javaws twice, each time referencing a different jnlp file. It looks like this:

javaws -wait -shortcut -import -system http://192.168.1.82/launch?[params]

javaws -wait -shortcut -import -system http://192.168.1.82/launch?[slightly different params]

Whichever jnlp file is second gets imported into System Applications. My guess is that it is overwriting the first imported application.

View Replies View Related

Recursive Backtracking Solution - How To Cache Answers Into Appropriate Array

Jan 23, 2014

I can often write a recursive backtracking solution, but don't know how to cache the answers into an appropriate array.

For example:

Java Code:

public static int max(int[] costs, int index, int total, int shares) {
if(index >= costs.length) {
return total;
}
int buy = max(costs, index + 1, total - costs[index], shares + 1); // buy one stock
int sell = max(costs, index + 1, total + shares * costs[index], 0); // sell all stocks
return Math.max(total, Math.max(buy, sell)); // compares between buy, sell, and doing nothing
} mh_sh_highlight_all('java');

This is a dynamic programming exercise, but I have no idea what dimensions the dp array should be (I was thinking maybe dp[index][total][shares], but that seemed like overkill). Is this just because my understanding of recursion isn't solid enough or am I missing something else?

View Replies View Related

Enterprise JavaBeans :: Separating Web And EJB Layer And Deploying On Different Servers

May 12, 2013

Web Layer - JSP/Servlets
Business Layer - EJB 3

I want to develop separate projects for web layer (.war) and for Business layer (.jar). I want to deploy these layers on different Glassfish servers.

Here is my Approach -

1. Create a separate module for remote interfaces (.jar), use @remote annotations
2. Create a Web module using JSP/Servlets (.war) and use this remote interface jar in it.
3. Create a EJB module (.jar) and implement these remote interface in it.
4. Use JNDI in Web layer to access the EJB methods.

I want to know if this is the correct approach?

View Replies View Related

Servlets :: Form Data Exceeding 10MB Gradually Which Is Not Being Accepted By Server

Jul 17, 2014

I am currently working on a module where huge amount of data needs to be sent to the weblogic server. The limit on Weblogic-> Server - > Protocols is 10MB.

The huge data is coming when i try to add more than 20 rows to the Ajax request.

There are possible two solutions for this

1) Increase the limit on Weblogic server to 1Gb which might lead to server crash when two or more users are trying to add 100 records at the same time.
2) Send memory in the form of chunks of (length of a row) every time I add a row. Store this in session and upon form submission retrieve from session. This cannot work if there are more than 20 users doing load testing as increase in session data decrease performance gradually.

I need that data passed to my server without any performance or errors.Currently its showing weblogic.socket.MaxMesssageSizeExceededException and RequestURI too long errors.

View Replies View Related

How To Insert Value Into SQL Server Table Column Of Data Type Datetime With JDBC

May 8, 2014

How can insert value into sql server column of data type 'datetime' with jdbc the methods in java.sql are 'setdate()' and 'setTime()'

How can I do this. I'm using java.time.LocalDateTime.

View Replies View Related

EJB / EE :: Port Asynchronous Bean Support In App Servers Like Weblogic And Jboss

Dec 26, 2013

I need to port asynchronous bean (provided by websphere) support in App servers like weblogic and jboss. Is this feature already part of J2EE specification? Or should I use some other external package to get this feature?If so what are those async bean like features for weblogic and jboss?

View Replies View Related

Servlets :: HTTP GET Default Method For Web Browsers Contacting Web Servers?

Sep 5, 2014

I am running a test servlet on Tomcat and have implemented different behaviours for the doPost and doGet methods. When I access from the browser, only the doGet method gets called ultimately.

The Firefox developer tools show me a GET request from the browser to my Tomcat instance. Do browsers ever call the POST http method? How could I make this happen?

View Replies View Related

Servlets :: How To Prevent Particular HTTP Header Attribute From Browser Cache

Feb 26, 2014

I am generating java script tag and javascript code in servlet and displaying it in each jsp page. i include this in every jsp in my application. I am preparing the following javascript content and diplayin each jsp

<script type="text/javascript"> BOOM.addVar (clientId = SOME universal unique ID ) </script>

the clientid will be uniqueid it gets generated every time.

Here my question is, is there any possibility the clientId will be store in browser cache or third party cache server. if yes how to prevent clientId from cache.

I don't want to prevent the whole jsp file from cache. i just want to prevent only that particular field. so that i can use advantages cache and also prevent particular header field to be cached.

Also can we prevent particular http header attribute from cache.

View Replies View Related

How To Make Button Clear The Data That User Entered

Mar 25, 2015

package com.example.imc;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

[Code] ....

View Replies View Related

Unable To Implement Custom Request Method In HTTP Header While Posting Data To Server URL

Jun 26, 2015

I have been trying to implement custom request method in HTTP header while posting my data to the server URL. My application specific URL accepts -X parameter and -d for the data and it is mandatory for that url. Basically I am trying to dump JSON data into my influx DB using CURL command which is working fine from the shell. But the issue is, if I am implementing the same in java with proper approach, it is not supported or working. My CURL command is :

curl -X POST -d '<my_json_data>' '<my_url>'

How can I implement the same in java using HttpUrlConnection or other available approach?

View Replies View Related

Array Not Being Updated

May 7, 2014

Two spots in my code not working as enteneded,in one spot it seems to be skipping threw my if statement and the other is not updating on my counter at the end

package roulette;
import java.util.*; 
public class Roulette {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
Scanner scan1 = new Scanner(System.in);
Scanner scan2 = new Scanner(System.in);
char userinput;

[code]....

View Replies View Related

Swing/AWT/SWT :: JTable Not Getting Updated

Nov 17, 2014

I am preparing a small solution. Below is how the functionality works.

1. Login Screen
2. Successful Login will take to a MDI Form
3. Click the menu, a JInternalFrame will open in the JDestopPane.
4. JInternalFrame has a JTable.
5. JInternalFrame has a JButton available for adding new data.
6. When JButton is clicked, a new JInternalFrame is popped up with some JTextField and JButton to save the data.
7. After saving the data (after insert query), a JDialog is opened to upload Logo (update query for BLOB), There are two buttons in the JDialog, one is for uploading the image, another one is uploading it later.
8. The logo is displayed in the JDialog and if the JButton, for upload is pressed, update the database and reload the JTable in the JInternalFrame is called.

My challenge is in point 8. The function is called properly, but the table is not getting refreshed.

JButton in JDialog for uploading the Logo
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(this, "Image Uploaded Successfully");
companyConfig cc = new companyConfig();
//cc.reloadTable();
cc.updateTable();
this.dispose();

[code]....

View Replies View Related

JavaFX 2.0 :: UI Not Fully Updated After Transitions (only On Linux)

Feb 27, 2015

After a transition of an object  the UI is not fully updated. One can still see "lines" from the "movement". This only happens on Linux (Debian) and not on Windows. Is this a known issue that has been fixed in later Javafx releases ? I am still using Java7 because of WinXP support

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved