items tagged with java
Written By: Administrator
Section: Java
Category: Tuning
2007-10-19 16:56:18
Still not enough, we were forced to profile the java code and make some big changes.... (from part 1)
Profiling
You either profile an application for speed and/or memory usage
and/or memory leaks. Our application is fast enough at the moment. Our
major concern is optimizing memory usage and thus avoiding
disk memory swapping.
Some words about architecture
It is not possible to profile any applications without having a deep
understanding of the architecture behind. The Product Catalog is an
innovative product which is a meta model for storing insurances product
in a database, a Product is read only and can derivate
instance that we call Policies. Policies are users data holder,
containing no text, just values, and sharing a similar structure as the
Product. This let the product know everything about (cross) default
values, (cross) validations, multiple texts, attributes
order/length/type
etc... and thus separate definition (Products) from implementation
(Policies). Products and Policies can be fully described with
Bricks, Attributes in a tree manner.
Reduce the number of object created
Looking at the code, we have seen that too many Products
(17 Products has 15000 objects either
Attributes/Bricks/Texts/Value/ValueRange) were loaded in
memory. While this is clearly giving a speed advantage on an
application server, it is simply killing the offline platform with it
1GB RAM (remember memory really free is 500Mb)
The problem is that Attributes and Brick are using/can use a lot
of fields/meta data in the database which translate into simple java type
(String for UUID, and meta data keys and values) in memory. We
start looking at the profiler and the 100 MB used by the product cache.
Reducing this amount of object was the first priority, a lot of them
are meta data which are common and spread across the Product Tree in
memory. Since avoiding creation of unneeded object is always
recommended, we decide to remove duplicate element in the tree by singularizing
them. This is possible because the product is Read Only and made of
identical meta data keys, meta keys value.
Read More About Enterprise Grade Performances Tuning With Critical Memory Constraints (Part 2)...
Written By: Administrator
Section: Java
Category: Interoperablity
2005-05-27 13:05:01
Mainsoft Corporation's porting solution, Visual MainWin, enables software developers to recompile their Windows source code (ASP.net, VB .NET) to java bytecode and let it run on Linux, Unix, HPUx/Itanium, Macintosh
As you know, when you compile an application in Visual Studio .NET, it generates Microsoft Intermediate Language (MS IL), which executes on the Microsoft Common Language Runtime (CLR) .NET framework. Grasshopper is a plug-in to Visual Studio .NET, which takes this MS IL and converts it into Java Byte Code, which executes on a Java Virtual Machine. Grasshopper also includes J2EE implementations of ASP.NET, ADO.NET, and the most common .NET namespaces, so the required dependencies are available on your J2EE platform.
Read more at http://www.mainsoft.com/,
Written By: Administrator
Section: Java
Category: Eclipse
2004-08-31 22:40:43
- Use only Eclipse and try to buy codepro or found a free plugin that create java pattern templates and has refactoring capabilities..
- Use only Borland if you need to do a RAD (Rapid applications development) applications
- And for the text editor or xml or xsl or whatever, use only JEDIT, it is free and for sure the best editor, many of my colleagues are still fighting, convince that ultraedit or notepad or mpad are a lot better. You are clever only if you accept sometimes you are not right....
- TCPviewer and Process viewer, free tools that can be download at www.winternals.com
Written By: Administrator
Section: Java
Category: Design Patterns Creational patterns
2005-01-20 21:31:29
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

Source Code
/**
* Abstract factory declares an interface for operations that create abstract
* product objects.
*
* @role __Factory
*/
public interface AbstractFactory {
/**
* Creates abstract product
*/
ProductA createProductA(); /**
* Creates abstract product
*/
ProductB createProductB();}
/**
* Abstract factory declares an interface for operations that create abstract
* product objects.
*
* @role __Factory
*/
public interface AbstractFactory {
/**
* Creates abstract product
*/
ProductA createProductA(); /**
* Creates abstract product
*/
ProductB createProductB();}
/**
* Abstract product - an interface for a type of Product object.
*
* @role __Product
* @see AbstractFactory
*/
public interface ProductA {
/*
* add product method declarations here
*/
}
/**
* Concrete Factory implements operations of AbstractFactory to create Concrete
* product objects.
*/
public class MyFactory implements AbstractFactory {
/**
* Creates concrete product ConcreteProduct1
*/
public ProductA createProductA() {
return new ConcreteProduct1(); }
/**
* Creates concrete product ConcreteProduct2
*/
public ProductB createProductB() {
return new ConcreteProduct2(); }
}
/**
* Concrete product defines a product object to be created by the corresponding
* concrete factory.
*
* @see MyFactory
*/
public class ConcreteProduct1 implements ProductA {
}
/**
* Concrete product defines a product object to be created by the corresponding
* concrete factory.
*
* @see MyFactory
*/
public class ConcreteProduct2 implements ProductB {
}
Written By: Administrator
Section: Java
Category: Design Patterns Structural patterns
2005-01-20 21:33:01
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.

Source Code
/**
* Defines an existing interface that needs adapting
*
* @role __Adaptee
*/
public class Adaptee {
/* Some adaptee-specific behavior */
public void specificRequest() {
// some adaptee specific stuff is going here
}
}
/**
* This class adapts the interface of Adaptee to the Target interface
*/
public class Adapter extends Target {
/** reference to the object being adapted */
private Adaptee adaptee;
/**
* @param adaptMe
* class to adapt whis this adapter
*/
public Adapter(Adaptee adaptMe) {
this.adaptee = adaptMe;
}
/**
* Implementation of target method that uses adaptee to perform task
*/
public void request() {
adaptee.specificRequest();
}
}
/**
* This class defines domain-specific interface used by client
*
* @role __Target
*/
public abstract class Target {
/** This method is called by client when he needs some domain-specific stuff */
public abstract void request();
}
There are 58 items tagged with java. You can view all our tags in the Tag Cloud

















