Opening/Closing a FileInputStream

Hi all,
We have a .properties file that should be checked from a servlet. The servlet will be hit by a load balancer every 5 seconds to see if the current node is active.
The old programmer in the company had it like this:
Properties propsFile = new Properties();
propsFile.load(new FileInputStream("some path"));
// check the propertyAs I understand, the above code leaves the file open all the time. Also is this a potential memory leak?
I'm thinking about changing it to
Properties propsFile = new Properties();
FileInputStream fis = new FileInputStream("some path");
propsFile.load(fis);
// check the property
fis.close();is this better? Furthermore my manager wants me to check the last modified date of the file and do not read it if it has not changed since the last read.
Would this bring a performance improvement? Since the file is only a few bytes long isn't it the same to just read it in one go?
Thanks

dvm wrote:
I'm thinking about changing it to
fis.close();
is this better? Deffinitely, the number of files you can have open is limited.
Furthermore my manager wants me to check the last modified date of the file and do not read it if it has not changed since the last read.This may make your manager feel better.
Would this bring a performance improvement? It will bring a small saving which may or may not make a difference to your application.
Since the file is only a few bytes long isn't it the same to just read it in one go?If the file is less than 64 kB its size isn't important.
It could save around 0.1 ms to avoid read the filing, but parsing the file could take longer.
You should be able to write a quick program to read and close the file repeatedly (for about 10 seconds) to get an estimate of how long this takes on your system.

Similar Messages

  • GL account opening/closing balances by day

    Hi All.
    I wish to list day by day opening and closing balances of G/L account by restricting the result to a time interval.
    Anyone know how to write the query for G/L account opening & closing balances by day?
    I found this in the forum and modify it to below:
    declare @fr char(10)
    declare @to char(10)
    set @fr=convert (char(10),[%0],20)
    set @to=convert (char(10),[%1],20)
    declare @PrCl dec(19,6)
    declare @de dec(19,6)
    declare @cr dec(19,6)
    declare @acc char(20)
    declare @Pracc char(20)
    Create table #W
      (M char(10), Acc char(20), Me char(100), Tid char(10), Br char(10), TT char(30), Op dec(19,6),De dec(19,6),Cr dec(19,6),Cl dec(19,6) )
    Insert into #W (M,Acc,Me,Tid,Br,TT,Op,De,Cr,Cl)
    SELECT convert (char(10),T1.[RefDate],20)Mo, T1.[Account],T0.Memo, T0.TransId, T0.BaseRef, CASE
    WHEN T0.TransType = 13 THEN 'AR Inv'
    WHEN T0.TransType = 14 THEN 'AR CN'
    WHEN T0.TransType = 18 THEN 'AP Inv'
    WHEN T0.TransType = 19 THEN 'AP CN'
    WHEN T0.TransType = 24 THEN 'Incoming Payment'
    WHEN T0.TransType = 30 THEN 'JE'
    WHEN T0.TransType = 46 THEN 'Outgoing Payment'
    ELSE 'Other'
    END AS 'Trans Type',
      0,T1.[Debit] De , T1.[Credit] Cr,0
    FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
    Group by T1.[Account],convert (char(10),T1.[RefDate],20),T0.Memo, T0.TransId, T0.BaseRef, T0.TransType,  T1.Debit, T1.Credit
    Order By T1.[Account],convert (char(10),T1.[RefDate],20)
    Declare cu cursor for
    Select acc,de,cr from #W
      for update
    set @PrAcc=''
    Open cu
    Fetch next from cu into @acc,@de,@cr
    While @@FETCH_STATUS = 0
    Begin
    If @acc!=@PrAcc set @PrCl=0
    Update #W
       set op=@PrCl,
           cl=@PrCl-@Cr+@de
      where current of cu
    set @PrCl=@PrCl-@Cr+@de
    set @PrAcc=@acc
    Fetch next from cu into @acc,@de,@cr
    End
    deallocate cu
    Select * from #w
    Where M between @fr and @to
    Drop table #W
    but some of the rows are missing from the result. e.g. row with the same value of debit/credit ( same TransId and BaseRef) will come out once only in the result.
    Please guide me on the above issue.
    Thanks & Best Regards,
    Leng

    Hi,
    You have to make use of many tables for this purpose.
    1. You have to claculate the previuos period and finscal year for the given date..
    2. You have to calculate the G/L balances for this period for the given G/L account from table GLT0.(You can use some of the standard function modules for the same)
    3. You have get the line items from the various tables like BSIS,BSAS,BSIK, BASK, BSID and BSAD for the dates from the begining of the month to the given date-1. sum upthis amount with the amount retrieved from step 2 .This will be the opening balance for the given date.
    4.retrieve the data from he same tables like step 3 for the given date. This will the transactions of the given date.
    5. sum up  the amounts from step 4 with step 3. this will be the closing balance for that date.
    let me know id you want any further info..
    Reward the points if i answered your question..

  • Opening & Closing balances of Vendor

    Hi Experts,
    I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
    Please help.
    Thanks
    Dany

    hi Dn,
    That would suffice for your requirement .
    Regards,
    Santosh

  • Opening & closing balances for Vendor

    Hi Experts,
    I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
    Please help.
    Thanks
    Dany

    Hi,
    There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
    Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
    Regards,
    Vinod

  • Storage location wise Opening/Closing Stock on posting date (mb5b)

    Hi,
    Report mb5b gives opening stock and closing stock as on date. In the selection screen, if we do not enter specific storage location then the opening/closing stock is displayed as sum of all storage location stocks for a given material.
    Where as if we enter storage location, it gives storage location specific output. (with Storage loc/batch stock radio button)
    My requirement is - without entering storage location in the initial screen, the system should display storage location specific opening/closing stock.
    To get this, presently I need to execute mb5b transaction individually for every storage location.
    Warm regards,
    MS

    Hi Madhavi
    This report you can have in T code MC.6 and another t code for opening and closing stock in t code MC.9
    Regards
    Vivek
    -- Reward if helpful
    Edited by: Supergene on Feb 28, 2008 3:17 PM

  • Query regarding Opened/Closed GL periods

    Hello Gurus,
    ive got an issue, when using 0FIGL_C01 Cube.
    The query ive created balances on cumulative balance (as key figure) and GL account names (as hierarchy).
    Now i want to show the data of cumulative balance regarding closed periods.
    I.e. if we have current April month the balance should be 0, but all other in the past January, February, March should be displayed.
    How it is possible to do this?
    Ive tryed to create a calculated key figure, whith code something like:
    IF debit and credit == 0 then Cummulative balance=0 else Cumulative balance.
    It works fine but it shows also the postings of current period, which isnt realy closed.
    Tried to search the indicators of FI open/closed periods, but the only thing i found is S_ALR_87003642 - Open and Close Posting Periods transaction showing Company code, GL account ranges and from to period data.
    What could be the sollution for this? Should i create new DS for the mensioned TC and then to create a multicube or perhaps is a better and faster way in doing it?
    Thanks a lot in advice
    Laurynas Prikockis

    Hi Shrikant,
    >
    Shrikant Varma wrote:
    > Yes, I could consider using belnr selection to reduce the size of the selection. This will again be a selection more
    > based on knowledge of application(of course with fine tuning of packet size).
    >  But then this approach will not be as efficient and as easy as letting database take control of the iteration of this
    > huge dataset - as is intended by the use of cursors with the help of packet size.
    >
    I'm not sure what you mean here: "let the database contorl the iteration of this huge dataset - with cursors".
    Generally speaking you have 2 options when it comes to parallel processing:
    Parallelize processes in the ABAP stack. These processes access different, non-overlaping, parts of your restult set
    in parallel. Using the BELNR could be an approach to build different, non-overlapping paackages.
    Database side parallelization. This is possible for every action that uses multiblock I/O (full table scans and index fast full scans) and for partitioned segments. For non-partitioned segments and single block I/O database side parallelization is not possible.
    So, generally speaking, you have 3 options:
    1.) parallelize in ABAP and build idependent packages
    2.) force the DB to do multiblock I/O (full table scan, index fast full scan) in parallel
    3.) partition your table and indexes.
    I think (it's just my opinion) for an ERP (not BW / BI) system
    - option 3 is not a good option for OLTP systems (several reasons). I see it very, very, very rarely or close to never in OLTP systems
    - option 2 may read (much) more data then you would need to read, although a very efficient I/O method would be used (multibock I/O)
    - option 1 requires programming in ABAP but will read exactly the data you need to read and can be controlled very well in the ABAP stack (parallel single block I/O will be used)
    In alamost all cases (that are similar to your case) i have see option 1 was used.
    Kind regards,
    Hermann

  • Authorization for opening & Closing posting periods - OB52

    Hi,
    Is there any way to set authorization for opening & closing of posting periods in OB52?
    My scenario:
    I have 2 company codes - A & B assigned to 2 different posting period variant - say PPA & PPB.
    The user belonging to CoCd A should not be able to open/close posting period of CoCd B and vice versa.
    Is this possible through any authorization settings?
    Request your help on this.
    Regards,
    Sridevi

    Hi Sridevi
    Please go through the following:
    You can assign authorization groups for permitted posting periods. This means that, for example, some posting periods can only be opened for particular users within monthly or annual closing. You can only assign the authorization group at document header level and it only affects period 1. The authorization object is called F_BKPF_BUP (Accounting document: Authorizations for posting periods). Read the corresponding chapter on "User maintenance" in the "Assigning authorizations" topic.
    "User maintenance"
    Due to the modular authorization concept of the system, you can define authorization profiles which are tailored to the workplace of your employees. You can, for example, assign authorization to a workplace in the Accounts Receivable, Accounts Payable or General Ledger Accounting areas.
    By assigning authorizations you define which business-related objects your employees are allowed to process and which editing functions are allowed.
    In the following activities for authorization management, you must carry out the following for employees who are to work with the system:
    Assign authorizations
    The authorizations are assigned by specifying permitted values for the pre-defined objects.
    Define profiles
    In the SAP system, authorizations are grouped together in workplace profiles. Therefore one or more profiles must be allocated to the individual employee in the master record.
    I hope this helps.
    Regards
    Kavitha

  • Mismatchin in opening & closing balance  ofj2i9 & j2i6 register

    Hi,
    We have done utilization on 1st of Month but the posting date was entered as 31st of previous month.
    Now the system showing mismatch in J2I9 & J2I6 between opening & closing balances for the previous period. The entry is missing in J2I9 but the same it is showing in J2I6 as Dr Entry. Why the system is not showing the Dr Entry in J2I9.And moreover the opening & closing balances are matching for the current and last month, but there is mismatch in the month of Dec in the same month utilization was carried out on 1st of Jan but posting date was entered as 31st Dec. What could be reason?
    Rgs

    HI !
    Now that we have not maintained the values in J_2iRG1bal, so how do I  correct the problem, what should I do so that the opening balance & closing balance values appear in the RG1 report.
    Kindly suggest.
    Regards,
    DGN

  • GL_DAILY_BALANCES table for daily opening/closing balance

    Hi All,
    I need to know something about the GL_Daily_Balances table. In eTRM, it says that the table gives the balances for a particular day. My requirement is to show the opening and closing balances on daily basis. But, I found that all the END_OF_DAY columns (END_OF_DAY1...END_OF_DAY35) are NULL.
    Can anyone tell me why these columns are NULL ? Under what conditions, they are null ? How can I get the opening /closing balance then?
    Thanks!
    Yogini

    Hi Yogini,
    This table is populated when balance processing is enabled in the definition of each set of books, do you have it?
    You can read about in the metalink note # 1072012.6
    Bye

  • Stock Statement - Opening & Closing Values

    Hi Guys,
    I am using the below query for  opening & Closing Stock Report.
    select a.ItemCode,a.Des, a.WareHouse , (SELECT (sum(t1.inqty - t1.outqty))
    FROM OINM t1 
    WHERE (T1.DocDate < '[%1]') and (t1.itemcode = a.itemcode) and
    (t1.warehouse = a.whs) ) as 'OB',
    a.Price,a.inqty as 'Goods Receipt',a.outqty as 'Goods Issue',
    (SELECT (sum(t1.inqty) - sum(t1.outqty))
    FROM OINM t1  
    WHERE (T1.DocDate <= '[%2]') and
    (t1.itemcode = a.itemcode) and (t1.warehouse = a.whs)) as 'Closing',
    (SELECT (sum (t1.transvalue))
    FROM OINM t1  
    WHERE (T1.DocDate <= '[%2]') and (t1.itemcode = a.itemcode) and
    (t1.warehouse = a.whs)) as 'ClosingValue'
    from (SELECT max(T0.[ItemCode]) as 'ItemCode',
    max(T0.[Dscription]) as 'Des',sum(T0.[InQty]) as 'InQty', sum(T0.[OutQty]) 'OutQty',
    t0.warehouse as 'whs' ,
    (select w1.whsname from owhs w1 where w1.whscode = t0.warehouse) as 'Warehouse',
    avg(T0.[Price]) as 'Price'
    FROM OINM T0 
    inner join oitm o1 on o1.itemcode = t0.itemcode
    inner join oitb o2 on o2.itmsgrpcod = o1.itmsgrpcod 
    WHERE (T0.[DocDate] >= '[%1]' and  T0.[DocDate] <= '[%2]')  and
    (TransType != '10000071'  and Transtype !='67' ) and
    (o2.itmsgrpnam >= '[%3]' and o2.itmsgrpnam <= '[%4]' )
    group by T0.[ItemCode],t0.warehouse)a
    But i need some changes in the Report and  below is the selection criteria,
    Pls somebody help me in achieveing this.
    Report 1:
    Item Group: Group B
    u2022 Column: Goods Issue
    Field to be fetched: Invoice Qty. for the respective FG items
    From Ware House No.: 02
    Fetching type: Cumulative for given date range
    u2022 Column: Goods Receipt
    Field to be fetched: Receipt from Production for FG items
    Receipt Warehouse: 02
    Fetching type: Cumulative for given date range
    Report 2:
    For Item Groups- Accessories, Consumables & Raw materials:
    Column: Goods Issue
    Issue from Warehouse No.: 08 ,33
    Field to be fetched: Issue for Production (BoM qty-Back-flush & Manual issue by system)
    Fetching type: Cumulative for given date range
    Column: Goods Receipt
    Receiving Warehouse No.: 08 ,33
    Field to be fetched: GRPO qty. against respective Purchase Order.
    Fetching type: Cumulative for given date range
    Report 3:
    For Item Group-WIP
    Column: Goods Issue
    Issue from Warehouse No: 04,09,17,18,20,21,23,28,29,30,31,32,34,38,39,44,45,46
    Fields to be fetched: All types of issues ( Issue for prodn. through Prodn.order, GI &
    Inventary Transfer)
    Fetching type: Cumulative for given period.
    Column: Goods Receipt
    Receiving Warehouse Nos:04,09,17,18,20,21,23,28,29,30,31,32,34,38,39,44,45,46
    Fields to be fetched: All types of Receipt (Receipt from Prodn. through Prodn.order, GR )
    Fetching Type: Cumulative for given period.
    Regards,
    Vamsi

    Dear Srini,
    Yes of-course Tally shows OB,and Closing balance at a particular time, SAP B1 Shows them too, but in a different manner.
    1. Suppose , you have given OB to SAP on 01/04/10.(which is actually the closing balance of Tally as on 31/03/10).
        Under trial balance report OB Column is there.
         If you are trying to populate Tally's OB of 01/04/09, You Can't.
    2. Getting the OB at a particular time in SAP, depends how you are maintaining your Posting Periods.
    For Closing balance in SAP, The last column -'Balance' is actually the Closing balance as on the date for you are running Trial Balance Report.
    Hope this will help you.
    Best Regards
    Ashutosh T

  • Opening & Closing balance of RG23A part II are miss matching for SECS only

    Hi Gurus,
    Opening & Closing balance for the month of May & April are mismatching for SECS only. where as BED & all other values are getting matched with April closeing & May opening.
    I have checked from Jan till Aprill everything is ok but after this in May i have problem.
    My closeing value in April for SECS is 40K where in May opening it is showing 5K. I use J2i6 to download the register.
    Plz can any one tell me how should i track this inconsistency.

    Its possible that some transactions are posted after you extract the report.  Extract the report again (J2I5) and print them. 
    Have you configured different GL accounts for posting BED, ECS & HCS.  From your description, it seems same GL is assigned for all three components.
    Ravi.

  • Opening & Closing Stock in transit

    Hi All,
    I Developed an abap report for Yield Statement with opening & closing Stock Quantities.
    How to Find opening & Closing For transit Stock for 641 movement.I mean how to display the current transit stocks date wise at plant level without SLOC.
    I Knew that current transit stock would be in Marc Table & previous closings in March Tables.
    I'm looking for the date logic with respect to displaying opening & closing dates of transit stock.Be it Date Wise Or Month Wise.
    Any help would be greatly appreciated.
    Thanks & Regards,
    Ravi S

    Hi Ravi,
    Please find the Link below hope they are very useful to you
    [Stock|Re: closing stock of a particular date]
    [Stock|Tables/FM for opening/closing stock for material on given posting date]
    Thanks
    kalyan

  • Opening/Closing System

    Hi Guys,
    In some cases, we open the SAP system to do some configuration for certain tables.
    We have to request the Basis team to open the SAP system..What exactly do we mean by this opening of the system?
    Are we allowing the customization of certain tables which is otherwise not possible in the Quality system?
    And we again need to close the system..What is the purpose of this opening/closing....
    thanks
    srik.

    Hi
    This is related to systems & Client set up required whenever you want to do a major changes and the following will help you more on this.
    http://help.sap.com/saphelp_46c/helpdata/en/2e/d9530294f911d283d40000e829fbbd/content.htm
    Regards
    Shan

  • Tables/FM for opening/closing stock for material on given posting date

    Hi All,
    I had requirement of find the opening/closing stock for material on given posting date. The values we can find out using TCode - MB5B.
    But I cannt use MB5B to extract data because I need to find detials for thousands of material.
    Can you please adivce if their is any FM or tables through which i can find this detial on any given date apart from current date.
    Thanks & Regards,

    Hi,
    [https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6593903]
    [https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6630975]

  • EBS Importing Opening / Closing Balances

    I am Importing EBS via transation FF.5 (APACS EBS), the file is importing all details except the Opening Balance and Closing Balance.  I have checked Algorithm and they are set up.   Using 4.7 Enterprise.  Has anyone got any suggestions.

    Hi,
    There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
    Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
    Regards,
    Vinod

Maybe you are looking for

  • ITunes keeps creating a new folder called "Music".

    Hello. This is really bothering me. I have my music stored on a server in a folder called "Music". All of the meta data etc is perfect as i went through every track and edited them as needs be. After doing a fresh install on my Mac, i draged n droppe

  • Can't load images: nullPointerException

    This one is baffling me. NetBeans nor my hard-coded Image seems to feel like showing itself and throws a nullPointerException instead. The stacktrace/full error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException         at maps.ma

  • Netgear access point

    I have just purchased the new extreme. Set up was straight forward and is at all defaults. I cannot however retain connectivity with a Netgear Universal WIFI internet adapter. WNCE2001. This is being used to connect a device onto my network that does

  • Disable Yahoo Sync after iCloud migration

    I am getting this pop up and it's driving me bonkers. I don't even use Yahoo sync, but I guess it was turned on when I had MobileMe. After the migration to iCloud, my MobileMe prefs have been disabled and it refers me to the iCloud prefs. Does anyone

  • Call the same report

    Hi experts, I have a urgent requirements ...... In the selection screen i have three fields . And i m displaying one alv report for a perticular vendor number .My requirement is when i am double clicking the vendor number then it'll show another outp