Releasing static classes in a browser environment
Hi all, got a problem I can't seem to find a solution for, so hoping someone knows what to do with this!
I'm running a Java applet in a browser, under Sun's JVM. It has a custom dynamic class loader, which queries our server and downloads patches to the software. However, this doesn't work entirely as planned. The JVM doesn't seem to want to clear the class cache until the browser is restarted. I'm also wondering about static class definitions and whether I'd have to do something different to refresh those too.
Ideally, when the loader starts and downloads patches to files, it then completely wipes out its previous definitions of cached classes, and reloads them all again from disk. Is this possible, and how would I go about doing it?
(The reason for this behaviour is my old old software ran on Java 1.1, and the MS Java plugin exhibits this behaviour, which our users were used to...)
Thanks in advance!
David
Thanks for the quick reply :)
The loader is not static, so it should be using a new
instance each time already? Or is it not sufficient
to simply make it not static?Not really sure how to answer that! It's not static, so presumably it's an instance field of some other class. Now, are you using a new instance of that object each time you download a new patch? If not, that'll probably be the problem. If so, then probably what's going on is, your classloader isn't loading the classes at all, but simply delegating to it's parent. If that's the case, you need to make that delegation fail, for example by not giving your classloader a parent
Similar Messages
-
Do static classes persist for the lifetime of the applet or the JRE in 1.4
I have an application that runs in a web browser and uses several applets that share data between each other using a static class. This method works fine for version 1.3 but not in 1.4.x. Do static classes now only exist for the lifetime of the applet?
I had a similar problem and solved it by setting the codebase attribute on the applet tags. The only documentation I have been able to find about this issue is here: http://java.sun.com/products/plugin/1.3.1_01a/new.html#classloader
-
Static Classes/Methods vs Objects/Instance Classes/Methods?
Hi,
I am reading "Official ABAP Programming Guidelines" book. And I saw the rule:
Rule 5.3: Do Not Use Static Classes
Preferably use objects instead of static classes. If you don't want to have a multiple instantiation, you can use singletons.
I needed to create a global class and some methods under that. And there is no any object-oriented design idea exists. Instead of creating a function group/modules, I have decided to create a global class (even is a abstract class) and some static methods.So I directly use these static methods by using zcl_class=>method().
But the rule above says "Don't use static classes/methods, always use instance methods if even there is no object-oriented design".
The book listed several reasons, one for example
1-) Static classes are implicitly loaded first time they are used, and the corresponding static constructor -of available- is executed. They remain in the memory as long as the current internal session exists. Therefore, if you use static classes, you cannot actually control the time of initialization and have no option to release the memory.
So if I use a static class/method in a subroutine, it will be loaded into memory and it will stay in the memory till I close the program.
But if I use instance class/method, I can CREATE OBJECT lo_object TYPE REF TO zcl_class then use method lo_object->method(), then I can FREE lo_object to delete from the memory. Is my understanding correct?
Any idea? What do you prefer Static Class OR Object/Instance Class?
Thanks in advance.
Tuncay@Naimesh Patel
So you recommend to use instance class/methods even though method logic is just self-executable. Right?
<h3>Example:</h3>
<h4>Instance option</h4>
CLASS zcl_class DEFINITION.
METHODS add_1 IMPORTING i_input type i EXPORTING e_output type i.
METHODS subtract_1 IMPORTING i_input type i EXPORTING e_output type i.
ENDCLASS
CLASS zcl_class IMPLEMENTATION.
METHOD add_1.
e_output = i_input + 1.
ENDMETHOD.
METHOD subtract_1.
e_output = i_input - 1.
ENDMETHOD.
ENDCLASS
CREATE OBJECT lo_object.
lo_object->add_1(
exporting i_input = 1
importing e_output = lv_output ).
lo_object->subtract_1(
exporting i_input = 2
importing e_output = lv_output2 ).
<h4>Static option</h4>
CLASS zcl_class DEFINITION.
CLASS-METHODS add_1 IMPORTING i_input type i EXPORTING e_output type i.
CLASS-METHODS subtract_1 IMPORTING i_input type i EXPORTING e_output type i.
ENDCLASS
CLASS zcl_class IMPLEMENTATION.
METHOD add_1.
e_output = i_input + 1.
ENDMETHOD.
METHOD subtract_1.
e_output = i_input - 1.
ENDMETHOD.
ENDCLASS
CREATE OBJECT lo_object.
lo_object->add_1(
zcl_class=>add_1(
exporting i_input = 1
importing e_output = lv_output ).
lo_object->subtract_1(
zcl_class=>subtract_1(
exporting i_input = 2
importing e_output = lv_output2 ).
So which option is best? Pros and Cons? -
Dynamic or Static Objects
It seems to me there is a big cliff at the point of deciding to instantiate your class at runtime or static load
on start-up.
My swf apps have a pent-up burst that happens a couple seconds into the run. I think I get this on most
web pages that have flash banners.
Flash apps that have a loader bar can take 60 secs. These ones usually come on with a bang with a lot of
high quality graphics.
Therer is a big processor spike at start-up with the browser loading http page. Flash seems to want a big spike
with its initial load. The javascript embed doesn't help either.
How to get a smooth start-up? Me English good.
This seems like a matter of correctness, only indirectly relating to speed.
The speed that a SWF loads from a web page is determined by many things, like server connection speed, client connection speed, browser cache size, client RAM, etc. Having static vs. dynamic classes would not impact this very much.
First of all, "static objects" is kind of an oxymoron because you can't instantiate (create an object) of a static class. I would say that having static variables/methods in a class is usually when you want some shared values/functionality without requiring an actual object (taking up memory) -- although static practices certainly extend beyond just this. I always try to think of a Math class. You wouldn't have to have to say m = new Math() just to use some common methods (square, sin, cos, etc.) or values (pi, e, etc.). They become kind of like "global constants/methods" in a sense (not to invoke the debate over correctness of that wording).
In short, it's more of a memory issue, which will like not have much influence over loading speed. If you want to improve your loading speed, you can try to delay the creation of your objects based on certain events instead of having them all load at startup.
How to get a smooth start-up? Me English good. -
Hello,
I am using MSVC C++ Express and Oracle XE. When I am building my C++ script I get the following errors:
DbCheck.obj : error LNK2028: unresolved token (0A00001F) "public: static class oracle::occi::Environment * __clrcall oracle::occi::Environment::createEnvironment(enum oracle::occi::Environment::Mode,void *,void * (__clrcall*)(void *,unsigned int),void * (__clrcall*)(void *,void *,unsigned int),void (__clrcall*)(void *,void *))" (?createEnvironment@Environment@occi@oracle@@$$FSMPAV123@W4Mode@123@PAXP6MPAX1I@ZP6MPAX11I@ZP6MX11@Z@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
DbCheck.obj : error LNK2019: unresolved external symbol "public: static class oracle::occi::Environment * __clrcall oracle::occi::Environment::createEnvironment(enum oracle::occi::Environment::Mode,void *,void * (__clrcall*)(void *,unsigned int),void * (__clrcall*)(void *,void *,unsigned int),void (__clrcall*)(void *,void *))" (?createEnvironment@Environment@occi@oracle@@$$FSMPAV123@W4Mode@123@PAXP6MPAX1I@ZP6MPAX11I@ZP6MX11@Z@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
F:\Visual C++ Projects\DbCheck\Debug\DbCheck.exe : fatal error LNK1120: 2 unresolved externals
I downloaded OCCI for Visual C++ 8 (Windows) Download (zip). but still get the error. I also linked oraocci10.lib and oraocci10d.lib but still nogo. I did it in the project property page under linker->input->additional dependencies. The configuration I choosed was:
Configuration: Debug
Platform: Win32
Is there a way to determine what is missing or what is causing the error, does one of you know how to solve the problem?
Thanks
RodgerCould you try to create a CLR command line application and get that to run first ?
This example here links and runs fine for me (it is a bit messy since I've been experimenting with my own mem leak problems, but it runs fine, you might want to change the select statement though)
(The stdafx.h file only contains #pragma once, the TestRead class is there just to test mapping from std::string to System::String)
#include "stdafx.h"
#include <occi.h>
using namespace System;
using namespace std;
using namespace oracle::occi;
public ref class TestRead
public:
System::String^ GetStr(int index);
internal:
oracle::occi::ResultSet* m_resultSet;
System::String^ TestRead::GetStr(int index)
try
return gcnew System::String(m_resultSet->getString(index).c_str());
catch (const oracle::occi::SQLException& ex)
throw gcnew System::Exception(gcnew System::String(ex.getMessage().c_str()));
return "";
int main(array<System::String ^> ^args)
try
oracle::occi::Environment *env = oracle::occi::Environment::createEnvironment((oracle::occi::Environment::Mode)(oracle::occi::Environment::OBJECT | oracle::occi::Environment::THREADED_MUTEXED));
Connection *conn = env->createConnection("test","test","");
try
oracle::occi::Statement *stmt = conn->createStatement("Select site_addr From parcel");
oracle::occi::ResultSet *rs = stmt->executeQuery();
TestRead^ testread = gcnew TestRead();
testread->m_resultSet = rs;
//int MktId;
string MktName;
int rowno = 1;
while (rs->next())
System::String^ name = testread->GetStr(1);
rowno++;
// if (rowno > 100)
// break;
stmt->closeResultSet(rs);
conn->terminateStatement(stmt);
catch (SQLException &ex)
env->terminateConnection(conn);
oracle::occi::Environment::terminateEnvironment(env);
throw;//re-throw
env->terminateConnection(conn);
oracle::occi::Environment::terminateEnvironment(env);
catch (SQLException &ex)
Console::WriteLine(L"Hello World");
return 0;
} -
Hello,
I would like to implement a LogWriter and avoid to create an object during application start and pass the LogWriter object to all classes writing logs. So the idea is simply to initialize some parameters (like logfile name) during application start and provide the LogWriter methods like writeLog as static methods. This works fine in a single user environment.
Question: What is the scope of the 'static' class. For instance if I set the Logfile according to a user name in the servlet init method, is this system wide or runs it in the context of the user?
Regards, rainerHello,
two answers. I did not use log4j for two reasons
1) I'm quite new to java and didn't know this project
2) Sometimes it's easier to provide some own code than convincing the customer to install and maintain an additional package. I do not want to maintain any software installations of additional packages for my tiny project if the time saving is not essential. In this case it took me less than one day to write my own logger class which provides enough functions for my need (e.g. level based filtering, formatted output, ...).
Back to the initil question bout lifetime. If a servlet is initilaized only once for many sessions and if I create any (static) helper object during Servlet init then this helper object is the same for all sessions and not only for all Get/Post's of this single session. That's what I needed to know.
Regards, Rainer -
What is the purpose of making a class static?
public static class December {
}The only reason I can see is to access inner-classes without instantiating the outer-class? Are there any other?see these
http://forum.java.sun.com/thread.jsp?forum=31&thread=277820
http://forum.java.sun.com/thread.jsp?forum=31&thread=305260 -
Creation of a static class with private methods
I'm new to java programming and am working on a project where I need to have a static class that does a postage calculation that must contain 2 private methods, one for first class and one for priority mail. I can't seem to figure out how to get the weight into the class to do the calculations or how to call the two private methods so that when one of my other classes calls on this class, it retrieves the correct postage. I've got all my other classes working correct and retrieving the information required. I need to use the weight from another class and return a "double". Help!!!
Here's my code:
* <p>Title: Order Control </p>
* <p>Description: Order Control Calculator using methods and classes</p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: Info 250, sec 001, T/TH 0930</p>
* @author Peggy Blake
* @version 1.0, 10/29/02
import javax.swing.*;
public class ShippingCalculator
static double firstClass, priorityMail;
//how do I get my weight from another class into this method to use??? not sure I understand how it works.
public static double ShippingCalculator(double weight)
String responseFirstClass;
double quantity, shippingCost;
double totalFirstClass, firstClass, priorityMail, totalShipping;
double priorityMail1 = 3.50d;//prioritymail fee up to 1 pound
double priorityMail2 = 3.95d;//prioritymail fee up to 2 pounds
double priorityMail3 = 5.20d;//prioritymail fee up to 3 pounds
double priorityMail4 = 6.45d;//prioritymail fee up to 4 pounds
double priorityMail5 = 7.70d;//prioritymail fee up to 5 pounds
quantity = 0d;//ititialization of quantity
// weight = 0d;//initialization of weight
// shippingCost = 0d;
//calculation of the number of items ordered..each item weights .75 ounces
quantity = (weight/.75);
if (quantity <= 30d)
//add 1 ounce to quantities that weigh less than 30 ounces
weight = (weight + 1);
else
//add 2 ounces to quantities that weigh more than 30 ounces
weight = (weight + 2);
if (weight > 80d)
//message to orderclerk ..order over 5 lbs, cannot process
JOptionPane.showMessageDialog(null, "Order exceeded 5 lbs, cannot process");
//exit system, do not process anything else
System.exit (0);
else
if (weight < 14d)
//send message to customer: ship firstclass or priority, y or n
responseFirstClass = JOptionPane.showInputDialog(null, "Ship first class? y or n?");
if (responseFirstClass.equals("y"))
//compute FirstClass shipping cost
totalFirstClass = ((weight - 1) * .23d) + .34d;
firstClass = totalFirstClass;
else
//compute PriorityMail cost for orders less than 14 ounces
priorityMail = (priorityMail1);
else
if (weight <=16d)
//compute totalshipping for orders up to 16 ounces
priorityMail = (priorityMail1);
else
if (weight <=32d)
//compute totalshipping for orders up to 32 ounces
priorityMail = (priorityMail2);
else
if (weight <=48d)
//compute totalshipping for orders up to 48 ounces
priorityMail = (priorityMail3);
else
if (weight <= 64d)
//compute totalshipping for orders up to 64 ounces
priorityMail = (priorityMail4);
else
//compute totalshipping for orders up to 80 ounces
priorityMail = (priorityMail5);
priorityMail = 0d;
firstClass = 0d;
firstClassMail ();
priorityMailCost ();
//I think this is where I should be pulling the two methods below into my code, but can't figure out how to do it.
shippingCost = priorityMail + firstClass;
return (shippingCost);
}//end method calculate shipping
private static double firstClassMail()//method to get first class ship cost
return (firstClass);
}//end method firstclass shipping
private static double priorityMailCost()//method to get priority mail cost
return (priorityMail);
}//end method priorityMail
}//end class shipping calculatorpublic class A {
public String getXXX () {
public class B {
A a = new A();
public void init () {
a.getXXX();
} -
Alternative to Static Class Inherit
Greetings,
I’ve been using some code for years in a different number of applications but that involves a lot of copy paste and is a nightmare to maintain. For that reason I’ve took some time to re-organize some of my codes and that mainly involves
splitting it into multiple projects for latter inclusion in a number of solutions.
So far so good and I’d say 95% is done but I’m now stuck with a Static Class I need to use. I basically need a few “Global” parameters and settings to be available across every solution. I know I can’t Inherit a Static Class nor override
a Field to return a different value unfortunately.
In a nutshell:
myFrameworkProject
namespace
myFramework.Classes{
//these contains general stuff
used in every project
public static class Globals{
public static
XPTO veryImportantProperty = new XPTO()
public static
Settings Settings = new Settings();
public void doSomethingImportant();
Public class Settings{
Private
string Username;
Private
string Password;
Private
string Whatever;
myFancyProject
namespace
myFancyProject.Classes{
//these add specific stuff used
in this project
public static class Globals : myFramework.Classes.
Globals {
public static
override mySettings Settings = new mySettings();
Public class mySettings: myFramework.Classes .Settings{
//some
more specific settings I need
Private
string SomethingElse;
What are my options? I’ve been trying to play with Singletons but for some reason I just can’t seem to make it work the way I want to…probably because it’s just not the right way to do it in the first place.I think you are over thinking it a little bit. The example you have above would be great if you had multiple setting types you wanted to retrieve within the same application domain instance using keys or specific types. The way I understand your problem
is you have one settings type per application that you run with various applications sharing a code base. Here is an example I created for you which better illustrates the solution I had in mind when I read your problem.
There are 2 namespaces, the one for your custom project(s) named FancyProject and then the Core / framework. Hope this helps!
namespace JF.FancyProject
using JF.Framework.Classes;
// in initialization of your default application domain (ie. in your application startup)
// inject your MySingleton with your custom implementation of ISettingsBuilder
// this can be done in many ways from hard coding in each startup routine to IoC / Dependency Injection
// the end result is this
public static class Console
public static void Main(params string[] args)
MySingleton.Initialize(new ConcreteSettingsBuilder());
// now you can use it where ever
var temp = MySingleton.SettingsConcreteInstance<ConcreteSettings>().SomethingCustom;
// or base
var temp1 = MySingleton.SettingsInstance.SomeBaseThing;
public sealed class ConcreteSettings : JF.Framework.Classes.SettingsBase
public string SomethingCustom { get; set; }
public sealed class ConcreteSettingsBuilder : BaseSettingsBuilder, ISettingsBuilder
public override SettingsBase CreateSettings()
var settings = new ConcreteSettings();
// call the base if you need to get standard settings populated
base.populateBaseSettings(settings);
// populate all of your custom settings
return settings;
namespace JF.Framework.Classes
public abstract class SettingsBase
public string SomeBaseThing { get; set; }
// base settings and behavior that can be abstracted
public static class MySingleton
private static SettingsBase _settings;
private static Lazy<SettingsBase> _lazyCreationMethod;
public static void Initialize(ISettingsBuilder builder)
_lazyCreationMethod = new Lazy<SettingsBase>(builder.CreateSettings);
public static SettingsBase SettingsInstance
get { return _lazyCreationMethod.Value; }
public static T SettingsConcreteInstance<T>() where T : SettingsBase
return (T) _lazyCreationMethod.Value;
public abstract class BaseSettingsBuilder : ISettingsBuilder
public abstract SettingsBase CreateSettings();
protected virtual void populateBaseSettings(SettingsBase settings)
// if you find many of your settings are created the same way use a base class
public interface ISettingsBuilder
SettingsBase CreateSettings();
Edit:
One more thought. I do agree with some of the other posters that for bigger projects the use of a Singleton pattern is not a good idea. For little applications it does not matter too much because chances are there is not enough substance that it will
hinder your code and the development cycles are generally very short.
Should you want to reconsider the Singleton pattern then I recommend you look at something like
Autofac, you could use this to inject instances of your ISettingsBuilder, or other concrete instances, directly into your dependent classes and you could take it further in developing self containing services that you could
inject as well.
Again, for small projects its not a big deal but if you ever start on something a bit more complex its worth looking into.
-Igor -
I am designing an EJB component (MessageDrivenBean) that requires
dynamic ("hot") configuration changes. As such, the bean must be
notified somehow of configuration changes in the DB (rather than have
to poll the DB for changes at every method call).
I'm thinking of implementing this functionality using a static class
instance (singleton) that is shared between the multiple instances of
the bean. This static instance would listen on a JMS topic for
configuration change events and update its internal cache accordingly
(by getting the configuration information from the DB). The beans
would then access this in-memory static instance everytime they need
configuration info instead of polling the database. By using the JMS
topic, I guarantee that clustered instances of Weblogic will all be
notified of the database changes (each instance would have its own
"cache" singleton).
I'm pretty sure all of this will work, but I'm equally sure that I'm
violating some EJB rules. Singletons and JMS listeners are generally
discouraged. Are there any alternatives to this design?Hi Joost,
This all seems to be pretty complicated. Not to mention that you can not
guarantee that members of a cluster will be notified simultaneously.
Why don't you want using the database?
"Joost Ouwerkerk" <[email protected]> wrote in message
news:[email protected]..
I am designing an EJB component (MessageDrivenBean) that requires
dynamic ("hot") configuration changes. As such, the bean must be
notified somehow of configuration changes in the DB (rather than have
to poll the DB for changes at every method call).
I'm thinking of implementing this functionality using a static class
instance (singleton) that is shared between the multiple instances of
the bean. This static instance would listen on a JMS topic for
configuration change events and update its internal cache accordingly
(by getting the configuration information from the DB). The beans
would then access this in-memory static instance everytime they need
configuration info instead of polling the database. By using the JMS
topic, I guarantee that clustered instances of Weblogic will all be
notified of the database changes (each instance would have its own
"cache" singleton).
I'm pretty sure all of this will work, but I'm equally sure that I'm
violating some EJB rules. Singletons and JMS listeners are generally
discouraged. Are there any alternatives to this design?Regards,
Slava Imeshev -
Usage of non static members in a static class
Can you explain the usage of nonstatic members in a static class?
Skydev2u wrote:
I just recently started learning Java so I probably know less than you do. But from what I've learned so far a static class is a class that you can only have one instance of, like the main method. As far as non static members in a static class I think it allows the user to modify some content of the class(variables) even though the class is static. A quick Google help should help though.Actually the idea behind a static class is that you dont have any instances of it at all, its more of a place holder for things that dont have anywhere to live.
Non-static members in a static class wouldnt have much use -
Attributes of private static class - private or package private?
Consider the following code:
public class Outer {
// Remainder omitted
private static class Nested {
int someInt = 10;
String someString = "abc";
}The nested class Nested is declared private, as it is only used by the Outer class... now I wonder... should I declare Nested's attributes private oder package private... either way, they can't be accessed from the outside... any ideas?stevops wrote:
either way, they can't be accessed from the outsideThat is true. However, when in addition the members of class Nested are declared as private, you will not be able to access them also from within the class Outer as well, i.e. int i = Nested.someInt; will give you compliation errorsAs a matter of fact, at most it'll generate some warnings, for it (the compiler) will generate synthetic accessor methods for Nested's fields.
All in all, if you plan to access private class members from an enclosing (or inner) class, you really only have two options: make them explicitly package-private, or make them implicitly so. -
Using Acrobat's Catalog (Index) function in a Browser environment
Operating in a browser-based Microsoft Sharepoint Server environment, our shop accesses a number of large aircraft-related manuals that consist of multiple documents in Acrobat PDF format. We were stymied whenever we attempted to perform a full-search of the documents (cataloged via an index.pdx file)—the function simply did not work. Strangely, even though we linked the search function to the correct index file on the network server, Acrobat searched for a file on one's local drive.
The documentation for Acrobat 7.0/9.0 offers the following explanation:
"To search an Adobe PDF index, you must open Acrobat as a standalone application,not within your web browser." But this information was hardly encouraging since we had no intention of giving up the browser-based environment.
Our IT staff has discovered there is a way to work around this restriction. The trick is to access the index file using Windows file protocol. This step in effect launches Acrobat as a standalone app within a browser environment. For example,
1. Add a bookmark labeled "(FULL TEXT) SEARCH" to the document's main navigation window
2. Edit the properties of the bookmark
a. Set the Action to "Open a web link"
b. Edit the URL to the fully-qualified address of the index file using the file protocol: file://..../index.pdx
NOTE: You have to use file protocol in order for the catalog function to work
3. Save the main document to enable the modifed link
4. Click the bookmark to launch the Search PDF window. The default Look In target now becomes the catalog file (index.pdx) of item 2b.How do you access the generic PDF, directly or through an HTML page? It shouldn't make a difference. More importantly, does a user accessing this file have access to all the folders/files associated with the bookmark, that is, are they on the same server?
Each of the slash pairs is meaningful. The notation with four slashes file://// ... implies that the host computer and a portion of the path is already known or defined, which I suspect is probably not the case for you. For details of the file URL, see http://www.cs.tut.fi/~jkorpela/fileurl.html. Attempting to access the index.pdx via http://... protocol does not work, as you point out, as it tries to locate the file in the temporary Interner folder on your local computer (as defined in the Internet Options dialog).
The following notation works in my environment:
file://z:\deptfolder\subfolder\subfolder\main_subfolder\pdf_subfolder\index.pdx (z: is a network drive)
file://hostname/deptfolder/subfolder/subfolder/main_subfolder/pdf_subfolder/index.pdx (hostname is our INTRANET server)
Added note: based on my reading of Acrobat 7.0/9.0 Help, the "Cannot find ..." error message indicates that the link relationship between the master file and the index has been broken. An index assumes a relative path exists between the index definition file (PDX) and the folder containing the indexed documents. If this relative path remains unchanged, you don't have to do anything after moving the indexed document collection. However, if the relative path changes or the index resides on a drive or server distinct from any part of the collection, you will need to create and build the index in the same location as the collection.
Using Relative Addressing
The fact that the Catalog index function relies on relative addressing can simplify the task of maintaining links if the relationship between files remains unchanged in moving from one environment to another. For example, given the following relationship
main_subfolder (menu file)
pdf subfolder (PDF files)
index subfolder (index definition file)
recreated in a browser environment, you can create the bookmark links in a menu file as:
Action: Open a web link ----> ./pdf subfolder/filename.pdf (open PDF document)
Action: Open a web link ----> ./pdf subfolder/index subfolder/index.pdx (open INDEX file)
in which the dot notation identifies (i.e., serves as a placeholder for) the path to the main_subfolder, The Open a web link function permits you to modify the contents of the URL. (Acrobat attempts to open each link using the file:// protocol.) For some reason, Acrobat may change the bookmark Action to "Execute a menu item" after you create and save it, but this step does not change the funtionality of the bookmark.
Message was edited by: tarusbulba 3/18/2010 -
Can we create static class in actionscript 3.0
Hi If yes please send me chunk of code .
thanksHi Prashanth,
There is no specifically a Static class in Flex that you can declare it at the compile time. However you can have Static variables and methods in your class and you can call them using the class name itself without creating an instance of that class.
Here is the chunk of code...
package com.constants
[Bindable]
public class ConsumerMessageConstants
public static const UNABLE_TO_ENROLL_PLANS_MESSAGE_ID:String = "10000";
public static const MARITAL_STATUS_UPDATED_MESSAGE_ID:String = "10001";
public static const ERROR_IN_EDITING_MARITALSTAUS_MESSAGE_ID:String = "10002";
public static const SMOKER_STATUS_SAVED_SUCCESSFULLY_MESSAGE_ID:String = "10003";
public static const PASSWORD_RESET_REQUIRED_MESSAGE_ID:String = "10004";
public static const ADDRESS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10005";
public static const UNABLE_TO_REMOVE_THIS_DEPENDENT_MESSAGE_ID:String = "10006";
public static const EMPLOYEE_SALARY_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10007";
public static const ERROR_IN_EDITING_SALARY_MESSAGE_ID:String = "10008";
public static const PLEASE_SELECT_A_CONSIDER_PLAN_MESSAGE_ID:String = "10009";
public static const YOU_MUST_CHOOSE_A_PLAN_COVERAGE_LEVEL_MESSAGE_ID:String = "10010";
public static const PLEASE_SELECT_PLAN_TO_LOCK_PORTFOLIO_MESSAGE_ID:String = "10011";
public static const DEEPDIVE_INFORMATION_SAVED_SUCCESSFULLY_MESSAGE_ID:String = "10012";
public static const NO_DATA_TO_DISPLAY_MESSAGE_ID:String = "10013";
public static const NO_PLANS_AVAILABLE_TO_ENROLL_MESSAGE_ID:String = "10014";
public static const NO_PLANS_TO_BE_ENROLLED_MESSAGE_ID:String = "10015";
public static const PASSWORD_CHANGED_SUCCESSFULLY_MESSAGE_ID:String = "10016";
public static const NEW_PASSWORD_AND_CONFIRM_PASSWORD_SAME_MESSAGE_ID:String = "10017";
public static const YOUR_DATA_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10018";
public static const HEALTH_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10019";
public static const HEALTH_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String = "10020";
public static const MONEY_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10021";
public static const MONEY_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String = "10022";
public static const PROTECTION_PLAN_IS_UPDATED_SUCCESSFULLY_MESSAGE_ID:String = "10023";
public static const PROTECTION_PLAN_IS_ADDED_SUCCESSFULLY_MESSAGE_ID:String = "10024";
public static const UNABLE_TO_RETRIEVE_PATHS_MESSAGE_ID:String = "10025";
public static function func1():Void
public static function func2():Void
public function ConsumerMessageConstants() -
Static class garbage collection
Can garbage collector can garbage collect static classes ?.
My doubt is that when you access a static class , that class is loaded through its class loader ( when first time that class is referenced ).
So when did the garbage collector collects this static class ( assume that static class no longer referred ).
Please do more information,
What are the ways to prevent garbage collector for a particular class ( Assume that i m implementing a singleton for my java runtime)
thanks and regards
Renjith.Can garbage collector can garbage collect static classes ?. Static classes are nothing special in terms of class loading - they are only different in visibility for linking.
Perhaps you mean static members of classes?
My doubt is that when you access a static class ,
that class is loaded through its class loader ( when
first time that class is referenced ). Classes are always loaded through classloaders. Objects of those classes are allocated from the heap, and the object instances refer to the class object.
Objects (either instances, or classes themselves) are garbage collected when they are no longer live (i.e. no live object refers to them). (This is a somewhat recursive definition, and sometimes, you can have cyclic dependencies that make garbage collection tricky, but the GC, while it has to be conservative for correctness, usually gets it right).
So for a static member to be garbage-collected, the class has to be garbage-collected first. The class cannot be GC'ed until all references to it go away (this includes all dynamically allocated objects of that type, and the class loader that loaded that class).
And yes, class loaders can go away, but only if they are created by your program. The system class loader (which is the default classloader you get if you don't create any class loaders of your own) never goes away, so any class loaded from CLASSPATH will never be unloaded.
(As an example, servlet containers - e.g. Tomcat, Weblogic, etc.) allocate one or more classloaders for each webapp. When the webapp is un-deployed, the classloaders are "orphaned", and they, and any classes loaded by them (from the WEB-INF/lib and WEB-INF/classes directories) are unloaded and garbage-collected. (After all the dynamic objects of those classes are GC'ed, of course).
>
So when did the garbage collector collects this
static class ( assume that static class no longer
referred ).
Please do more information,
What are the ways to prevent garbage collector for a
particular class ( Assume that i m implementing a
singleton for my java runtime)
thanks and regards
Renjith.
Maybe you are looking for
-
IPhoto 8.1.1 crashes immediately at startup
This crash started happening after I installed a new hard drive in my MacBook Pro and restored from a Time Machine backup. I've tried deleting the prefs, but that had no effect. I also held down option-command, but the crash occurs immediately. iPhot
-
recently I have install windows 7 in my old laptop since then the program Itunes have 2 libraries one at the top which I can put in new music and the other just below my I touch device botton. The problen is that now whenever I upload music is going
-
Could not find it? Can you?
When I run this program I can see the message and I can input number but when methods returns d I can not see the value of d at all. I get a message on the applet like this: Start: applet not initialized import java.awt.Container; // Java extension p
-
ISA 570 Web filtering: can't configure
Hi I have the latest firmware installed but for some reason I don't get the pencil icon when I try to edit a policy profile in Web URL filtering under Security Services. Any help would be appreciated
-
Execute button for BEx Analyzer in the Query Designer
Hello, My current BEx Query Designer 7.1 and we are using Excel 2003. Currently, I can execute query through BEx Web but I am also looking for green check button of BEx Analyzer also. Could you please tell me how can I incorporate/add this BEx Analyz